As many of you know, I use Amazon Web Services to do much of my work and S3, Simple Storage Service, is a large part of what I work with. Today, I was made aware that someone could not download an EXE file from S3 onto their desktop. I tested it out, and it was fine for me. Classic developer response right? Turns out, it worked for me because I was using Chrome on my Mac. It didn't work quite right in Internet Explorer on Windows. The file would download, but it would not bring down the extension to the file. What I mean, is if the file was stored in S3 as "filename.exe", when it was downloaded to the Windows machine it would only be named "filename". I was encouraged by some people that I know to simply chalk it up to a security concern, and while I do not encourage anyone downloading random .exe files and installing them, I knew that this just couldn't be the case. As it turns out, Internet Explorer must be told the Content-Disposition of the file when it is an EXE or DLL. This is done in the headers when the file is requested. Luckily, S3 allows you to put metadata on a file that is passed down when the file is requested. To allow Internet Explorer to recognize and save the file with the .exe extension you will just need to add the Content-Disposition:attachment; filename=<filename.exe> header.
You can do this as metadata in S3 through the AWS console. Many of the software utilities that work with S3 also allow you to set this metadata programmatically when storing the objects.
Cheers heaps for this! threw me off for ages too...
Anthony, I am glad that it was helpful. Thanks for stopping by
Thanks, this saved me from pulling out my hair!
IEEE Projects on Cloud Computing
Final Year Projects for CSE
Cảm ơn bạn đã chia sẻ, nếu cần gửi hàng đi phú quốc thì a/c liên hệ bên mình nhé. Hotline: 0903751981
Post a Comment