Click here to Skip to main content
15,889,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have this code in my handler file which write binary content of file to browser and allows user to view/download/save it.
I have a requirement where i want to write image file to browser ,image file is created using HTML5 canvas and the image data is retrieved using toDataURL() method of canvas. Is there any way to write this data to browser using javascript something similar to my existing c# code
C#
private void WriteFile(byte[] content, string fileName, string contentType, HttpResponse response)
       {
           response.Buffer = true;
           response.Clear();
           response.ContentType = contentType;
           string extension = System.IO.Path.GetExtension(fileName);
           if (extension != ".htm" && extension != ".html" && extension != ".xml")
           {
               response.AddHeader("content-disposition", "attachment; filename=" + fileName);
           }
           response.BinaryWrite(content);
           response.Flush();
           response.End();
       }
Posted

1 solution

After a little googling, i saw this link, I hope it;s helpful.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900