Click here to Skip to main content
15,890,557 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to upload image to server using web api in mvc dot net.
i am new at learning of Web Api and i want to upload image to server using web api.
please guide me how i can do this.

What I have tried:

                            string img = username + "_" + labTestId + fb;
                            var element2 = image;
                            MemoryStream ms = new MemoryStream(Convert.FromBase64String(element2));
                            byte[] imagesbytes = ms.ToArray();
                            string folder_name = "lab-orders";
                            folder_name = folder_name.ToLower();
                            string SaveLocation = ServerConfig.BlobPath + folder_name + "/" + fb+imagesbytes;
                            BlobUploader.UploadTo(folder_name,img, ms);
var filePath =HttpContext.Current.Server.MapPath(SaveLocation + postedFile.FileName + extension);

 postedFile.SaveAs(filePath);
Posted
Updated 11-Jan-18 5:18am
Comments
Richard Deeming 11-Jan-18 12:15pm    

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