Hye,
I need to open a document of type (pdf, doc, docx, xlsx etc) and download and save it.
The whole scenario is:
I am working on a mobile website where user can log in and add some of there information and then some documents are created according to these information given of the above types.
Now the Title of those documents are listed in "ul, li"
Also these Documents are not saved in any folder but else its contents are to be saved in Database as byte array along with its extension. At the time I click the link, it should fetch all the information and a popup should appear asking whether to save or open the file. If I click save, it should download the file and save it in mobile's SD card.
Now, Please let me know how can I do this :
this.Response.Clear();
this.Response.ContentType = MimeType;
this.Response.AppendHeader("Content-Disposition", "attachment;filename=demoFile" + DocumentExtension);
Response.OutputStream.Write(DocumentContent, 0, DocumentLength);
Response.Flush();
Response.Close();
through javascript.
Is there any way.
and if not, how can I let a file either to open or save and if clicked "save" it downloads and save.
I don't have any path for that file, as the file is not saved somewhere, all the data is taken from database.
i have to render the byte array, how can I do this.
Thanks in advance.
[Also please prefer the code is to be in javascript]