简体   繁体   中英

Save byte array of image in a folder c#

I am converting image name to byte array and i want to save that byte array in a folder here is my code to convert byte array

 byte[] imgArray = obj.Image.ToByteArray();

where obj.image=image(1).jpg. which is of string type.

and I want to save it in my project folder "Images" so how can i do it after converting that image file to byte array. please give me some idea to do that

here is my project folder where i want to save the file. D:\\Gaurav\\VerveLogicTfs\\LogoProject\\ProfilePic

Try this.

string filePath = "~/ProfilePic/" + obj.image.ToString();
File.WriteAllBytes(Server.MapPath(filePath), imgArray);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM