我在我的網站和移動應用程序上有相同的頁面。Xamarin.forms如何從移動應用程序上傳圖像,如asp:FileUpload控件
在網站上我使用asp.net FileUpload控件上傳文件到服務器。
//saving the file
FileUpload1.SaveAs("<c:\\SaveDirectory>" + FileUpload1.FileName);
在移動應用程序,我是搜索客場做到這一點,使用上上傳文件幾乎相同的代碼..
我使用Xamarin.forms
我有對象圖像包含圖片選擇或挑選我有文件路徑如下
public static Image DriverImage;
DriverImage = new Image();
DriverImage .Source = ImageSource.FromStream(() =>
{
var stream = file.GetStream();
file.Dispose();
return stream;
});
我需要在這裏做什麼?
所以@亞當如何將圖像上傳到服務器??! –
我可以從Xamarin.Forms.Image轉換爲System.Drawing.Image,然後使用Image.Save(圖像) –
要發送到服務器,您需要在服務器上構建一個API併發送圖像,通常作爲字節數組。像這樣的東西:http://stackoverflow.com/questions/33367834/send-image-to-webapi-service –