如何使用web api将图像上传到服务器?请帮我 [英] How I can upload image to server using web api ? please help me

查看:194
本文介绍了如何使用web api将图像上传到服务器?请帮我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在mvc dot net中使用web api将图像上传到服务器。

i是我在学习Web Api时的新手,我想使用web api将图像上传到服务器。

请指导我如何做到这一点。



我的尝试:



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);

推荐答案

Google是你的朋友。



如何使用web api将图像上传到服务器 - Google搜索 [ ^ ]



上述搜索的第一个链接



[ ^ ]



<小时ef =https://ppolyzos.com/2016/02/07/upload-a-file-to-azure-blob-storage-using-web-api/>使用WebApi将文件上传到Azure Blob存储 - 巴黎Polyzos的博客 [ ^ ]
Google is your friend.

How I can upload image to server using web api - Google Search[^]

First link from the above search

[^]

Upload a file to Azure Blob Storage using WebApi – Paris Polyzos' blog[^]


这篇关于如何使用web api将图像上传到服务器?请帮我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆