Unable to override content disposition header in s3


I’m using the following php function to give temporary access to the public for a private file.

I wanted to add the content disposition header so I can change the filename to test.mp3 when a user tries to access this url which defaults the filename to 982jdjd2p3.mp3

I tried adding the following line of code to the function

However when I click on the url


The proposed filename is to be saved as 982jdjd2p3.mp3

How do I override the content disposition header for s3 GET requests using this function?

See Also

Amazon S3 Change file download name


Here is the most recent attempt to rename the file with a get request using this function.


The problem with your function is that the header values should be encoded in the final hyperlink, but not for signing. The following function corrects that:

Leave a Reply