tags:

views:

1539

answers:

3

Hi

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.

+1  A: 

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

Samiksha
+3  A: 

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?

jayrdub
To add to this, use a hidden `<iframe />` that will download the file. Put a progress bar on the page and add an onload event to the `<iframe />` that hides the progress bar.My two cents,nickyt
nickyt
Yeah that is exactly how the article describes it , i was hoping to write to the response but i know you cant do that so was looking for alternatives
RC1140
+1  A: 

I have decided to use the IFrame method is there is no other way that works seamlessly enough to make it worth the time.

RC1140