How do you take an image (passed in as a Base64 encoded string) and save it to the server in Asp.Net C#? -
I want to create a function like this ...
[AcceptVerbs (HttpVerbs post) }] Public Action Result Sevimage (String File, String Filename) {}
Where file base is 64 encoded string that is created from the image, and the filename is the name that I want to save it Like How can I use this encoded string to write an image on the server?
Do I need to use BinaryWriter
or TextWriter
or something else? And how do you decode it to allow data to be written properly on the server?
byte [] content = convert.forbase64 string (file); System.IO.File.WriteAllBytes (Server.MapPath (fileName), content);
Comments
Post a Comment