Download Attributes (aka downloading files via html single click)

Hi, I’m trying to allow my video render files to be force-downloaded via a single click within my app.

I tried using the download attribute with < a > tags using the render URL from ShotStack’s CDN. There are two issues, however:

  1. It appears that in order to allow force downloading, the metadata needs to be edited for the file in the S3 bucket. It must be changed to Key = “Content-Disposition” and Value = “attachment”.

I tested this out with my own S3 bucket as opposed to SS’s CDN, and it was successful.

< a href=“https://MyBucket/my_file_url.mp4” target="_blank" >Download

The solution I found is described here: Amazon S3 - Overview - Easy Digital Downloads

  1. Unfortunately, the method above does not allow for renaming of the download files due to browser security reasons.

For example, < a href=“My_URL” download=“My New File Name”> only works for same origin URLs.


This leaves me (I think), with the option of hosting my own render files temporarily within my own S3 bucket, and changing the file names from there.

I do not want to opt out of SS’s CDN hosting completely.

Can you please help me ideate another solution?

Hi,
There is no simple solution to this, it has been in a our backlog for a while and was actually something we tried to do for our own demos.

Technically there are a few things we’d need to look at across S3, CloudFront and permissions settings. Or we host two versions of the file, one with the content-disposition:attachment set.

Another solution we are working on is an S3 destination that will let you specify your own S3 bucket to move files to, as part of this we could let you set the content-disposition. You can have multiple destination so use Shotstack for streaming and your own bucket for downloads.

For the time being however I think you will need to host a copy of the file on your own S3 bucket and set the content-disposition yourself.

Will keep you posted on progress of this feature in the future.

Thanks for the reply!

The S3 destination sounds great. Right now I’m going SS to MyApp to S3 Bucket back to MyApp. So having the option (eventually) to do SS to MyAPP and S3 would be nice to have.

1 Like