Click here to Skip to main content
15,897,968 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI i am at learning phase of web api in asp.net mvc.

i want to upload image to web server online using WEB API by posting data.
i want to take that path of web server to the database with the converted image to base64 but it tooks too much lengthy string. how to upload this and get short length image path in web api.
please help

What I have tried:

i have tried this please help me to get the short length image path using web api

string fn = string.Empty;
var element2 = image.Split(',')[1];
fn = username + "_" + labTestId + ".jpg";
MemoryStream ms = new MemoryStream(Convert.FromBase64String(element2));
string folder_name = "lab-orders";
folder_name = folder_name.ToLower();
string SaveLocation = ServerConfig.BlobPath + folder_name + "/" + fn;
BlobUploader.UploadTo(folder_name, fn, ms);

LabTestNames labtstnames = new LabTestNames();
labtstnames.ImagePath = SaveLocation;
Posted
Updated 10-Jan-18 1:10am
Comments
F-ES Sitecore 10-Jan-18 7:14am    
Not sure what you're actual question is but it looks like you need to implement an action that returns your image from the database as a binary response.

https://stackoverflow.com/questions/880515/display-image-from-database-in-asp-mvc
Member 13605985 11-Jan-18 1:15am    
i want to upload image to server from web api

1 solution

 
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