Question

object storage downloading

is there a way with object storage to perm share something but have it so that when a person downloads, it lets them choose where on their computer they can download it?


Submit an answer


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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
March 12, 2024

Hey!

DigitalOcean Spaces is an object storage service that allows you to store and serve large amounts of data. When you provide a direct link to a file stored in DigitalOcean Spaces, the behavior of the download—specifically, where the file is saved on a user’s computer—primarily depends on the user’s web browser settings, not on the object storage service itself.

Typically, when a user clicks a download link, the browser will either immediately download the file to a default location (usually the ‘Downloads’ folder) or prompt the user to choose a location, depending on the browser’s settings. Users can configure their browser to always ask where to save files before downloading.

So, while you can’t control this behavior directly from DigitalOcean Spaces, you can inform your users that they can set their browser preferences to choose their download destination each time they download a file. If providing instructions, you may need to cover a range of popular browsers, as the process can vary between them.

However, if you’re building a web application and want to provide more controlled behavior for file downloads, you might need to implement a custom solution on your website that interacts with the browser to prompt users for a download location. This could involve using JavaScript or other web technologies, but it’s essential to note that due to security and privacy reasons, web browsers heavily restrict the level of control a website can have over the user’s filesystem.

So in short, while you can’t control this directly through DigitalOcean Spaces, users can set their browsers to ask for a download location, or you can explore web development solutions if you need more customized behavior.

An alternative thing that you could consider here is to use the DigitalOcean Spaces presigned URLs. This is a standard S3 feature that allows you to generate a temporary URL for a private object in your Space, giving someone temporary access to download it. This is particularly useful for sharing files securely and controlling access to your stored content:

https://docs.digitalocean.com/glossary/pre-signed-url/

But again, when it comes to downloading files using a presigned URL, the behavior is similar to accessing files via any direct link on the web. The ability to choose a download location isn’t determined by the fact that the URL is presigned but rather by the user’s web browser settings. If the browser is configured to ask the user where to save downloads, it will prompt for a location. If it’s set to download files automatically to a predefined location, it will not prompt the user.

The presigned URL doesn’t inherently include any mechanism to influence or control where the user saves the file on their computer. Its primary purpose is to authorize access to a file without requiring the user to have a DigitalOcean account or permissions to the Space. Once the file is being downloaded, it’s the browser’s standard download behavior that takes over.

If you need the user to choose a specific location for the file or to handle the file in a particular way, you would need to implement that logic on your website or application, keeping in mind the browser’s security restrictions related to file handling.

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel