使用IOS和android进行图像上传时,我有ASP.net Web服务。设备为图像发送Web服务多部分数据。如何在Web服务中读取多部分数据并保存到数据库的路径并将图像保存到文件system.Kindly帮助
答案 0 :(得分:1)
[HttpPost]
public HttpResponseMessage UpdateImage()
{
if (HttpContext.Current.Request.Files.Count > 0)
{
var filepath = HttpContext.Current.Request.Files[0];
if (!string.IsNullOrEmpty(filepath))
{
string ImageLocalPath = HttpContext.Current.Server.MapPath("~/UploadImage/" + file.FileName);
file.SaveAs(ImageLocalPath);
// write code for insert in the database and give ImageLocalPath parameter in a stored procedure to store path, also create UploadImage folder to store image
}
return HttpResponseData.OkResponse();
}
}