Save jpg on project folder instead of show to user

Last Reply one year ago By Shashikant

Posted one year ago

Hi,

 

I have this code which is export div data to png its working fine.

I want when click on button div export to png and save it on project folder as image and user just receive message that image save successfully.

 

 

Posted one year ago Modified on one year ago

Hi,

Please refer below code

C#

string base64 = Request.Form[hfImageData.UniqueID].Split(',')[1];
byte[] bytes = Convert.FromBase64String(base64);
File.WriteAllBytes(Server.MapPath("~/MyImage/ImageName.jpg"),bytes);

VB

Dim base64 As String = Request.Form(hfImageData.UniqueID).Split(","C)(1)
Dim bytes As Byte() = Convert.FromBase64String(base64)
File.WriteAllBytes(Server.MapPath("~/MyImage/ImageName.jpg"), bytes)

I hope this will help you out.

 

I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html