Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 以流形式发送图像(Android)_C#_Android_Rest - Fatal编程技术网

C# 以流形式发送图像(Android)

C# 以流形式发送图像(Android),c#,android,rest,C#,Android,Rest,我设置了一个REST服务来接收数据流,并将其保存为图像 [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "UpImage/{path}")] void UpImage(string path, Stream filecontents); public void UpImage(string path, Stream filecontents) { Image img = Syst

我设置了一个REST服务来接收数据流,并将其保存为图像

[OperationContract]
    [WebInvoke(Method = "POST", UriTemplate = "UpImage/{path}")]
    void UpImage(string path, Stream filecontents);

public void UpImage(string path, Stream filecontents)
    {
        Image img = System.Drawing.Image.FromStream(filecontents);
        img.Save(System.Web.Hosting.HostingEnvironment.MapPath("~/attachments/test/") + "SrvTest.jpg", ImageFormat.Jpeg);
    }
我希望通过android上的AsyncTask连接到服务并收集其响应

我的问题是我不确定如何以流的形式发送图像,我看到很多信息以字节数组的形式发送它们。 这可能吗?如果可能,如何实现