Hi, I want to store in DO images, that are firstly processed by optimization service. Steps:
Is it possible to upload a file with presigned-url by sending just a url to the file instead of sending actual file in the request body?
If not, is there any other method to upload a file from another location (having only the fileurl)?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Heya, @itworksonmymachine
No, a pre-signed URL upload to DigitalOcean Spaces (S3-compatible) is just an authenticated PUT (or POST) to the object URL, and the body of that request must be the actual bytes of the object. You can’t “hand it a URL” and have Spaces fetch the file for you.
If you only have a fileUrl, you have two practical options:
Your service acts as the copier: download the optimized file from fileUrl (server-to-server), then PUT that same byte stream to the Spaces pre-signed URL (or upload with normal S3 credentials). This can be fully streamed so you don’t store the whole file on disk.
If the optimizer can do it: have ImOpt upload directly to Spaces using your pre-signed URL. Many optimizers/webhooks support “deliver output to S3 via pre-signed URL” where they PUT the result themselves.
Spaces doesn’t provide a “remote URL ingest” feature (like “fetch this URL into a bucket”) out of the box, so something (your backend or the optimizer) has to perform the actual transfer.
Regards
Hi there,
I might be wrong, but as far as I know a presigned URL always expects the actual file data in the request body. You can’t pass a file URL and have Spaces fetch the file on your behalf.
The usual ways people handle this are either downloading the optimized file from that URL in your service and then uploading the bytes to Spaces, or generating the presigned URL first and letting the image optimization service upload directly to it if they support that flow.
If both sides were S3 compatible you could sometimes do a server side copy, but with just an external file URL that isn’t an option.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.