0
第一次發佈!在這個特殊案例中,我一直在嘲笑我。我有一個Web應用程序需要上傳一個文件到一個web-api並接收一個SVG文件(在一個字符串中)。如何從WebClient.UploadData中讀取數據
的web應用程序上傳文件,如下所示:
using (var client = new WebClient())
{
var response = client.UploadFile(apiUrl, FileIGotEarlierInMyCode);
ViewBag.MessageTest = response.ToString();
}
以上的作品,但後來我們得到的API部分: 如何訪問上傳的文件?僞代碼:
public string Post([FromBody]File f)
{
File uploadedFile = f;
String svgString = ConvertDataToSVG(uploadedFile);
return s;
}
換句話說:如何上傳/發送XML文件到我的網絡API,使用/操縱它有發送其它的數據?
在此先感謝! 尼克
PS:我想這個答案: Accessing the exact data sent using WebClient.UploadData on the server 但我的代碼沒有對Request.InputStream編譯。