I am looking for a way to allow users to download a file from my site using ajax. The reason why i need to do this is because the files are quite big (50 megs normally). So when the user clicks the download button it actually looks as if the page is not responding because it has to stream the file from my Amazon S3 to the user.
So i need to notify the user that the download is in progress and maybe even give them a progress bar. I have found the following article but i am not really keen on injecting iFrames into my webpage.
Thanks in advance for any help.
You need to set it according to your file type. You can use this technique to download any kind of files. "We cannot download the file through Ajax, must use XMLHttpRequest". XMLHttpRequest is AJAX by definition.
I don't really see how you can allow a user to download a file using ajax. There won't be any way to get the file to their filesystem from javascript. What's wrong with targeting the file into an iframe or a new window and letting users manage the download like they are used to using their browser?
I have decided to use the IFrame method is there is no other way that works seamlessly enough to make it worth the time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With