Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
Check base64 string(image) type using C#
mari muthu
Jun 2 2017 9:43 AM
696
Reply
hi,
Actually my application i have the upload image functionality there i have passed one parameter(base64string) to my controller. here i want to check the base64string type . i tried one way but that was wrong if anybodys know please tell me that answer .
i need to change this line . how to check the type inside that string ,
<pre> string x = base64image.Replace("data:image/png|tiff|jpg|gif;base64,", "");</pre>
this is my code,
public bool LoadImage([FromBody]string base64image)
{
string x = base64image.Replace("data:image/png;base64,", "");
byte[] data = System.Convert.FromBase64String(x);
MemoryStream ms = new MemoryStream(data);
Image img = Image.FromStream(ms);
return false;
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
read word document(doc,docx) content to a string
Do not want to see the time in itextsharp report