PDA

View Full Version : Download a file from mssql database.



Cloetn
4 May 2011, 11:16 PM
Hi,

When people get on the mobile site they get to see a list of their documents which are on a mssql database server.

Now when they click an item they should have the chance to download it. What I have done so far is made an ajax.request to a webservice. This webservice method will take the file from the database and parse it to bytes[] and then pass it back to the Sencha Touch site.

Now how do I parse this back into a file? I don't really think this is the right solution but I don't see any other one at the moment :(


Many thanks,
Kevin

realjax
4 May 2011, 11:28 PM
Don't do an ajax request for file downloads. Your better off having the server deal with it, open een iframe, post a form, have the server return the result as a specific document MIME type in the iframe.

Cloetn
5 May 2011, 4:15 AM
Thanks for the answer,

So I just put a hidden iframe in my page that posts to a server who will response with the file to that iframe?

And when I want to download that file I just have to submit that form through javascript?