简体   繁体   中英

Allow User to Download File using Ajax

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.

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.

Add a progress bar on your page and Use postback triggers for your updatepanel. It will solve the issue you are facing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM