Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/199.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
Android Wcf Rest服务,用于上载具有暂停和恢复功能的文件_Android_Wcf_File Upload - Fatal编程技术网

Android Wcf Rest服务,用于上载具有暂停和恢复功能的文件

Android Wcf Rest服务,用于上载具有暂停和恢复功能的文件,android,wcf,file-upload,Android,Wcf,File Upload,我正在尝试创建一个wcf rest服务,以便从Androidmobile向服务器上传文件。为此,我创建了以下rest服务 代码 byte[] buff = new byte[10485760]; using (FileStream fs = new FileStream("D:\\FileUpload\\" + "filename", FileMode.Create)) { int bytes

我正在尝试创建一个wcf rest服务,以便从Androidmobile向服务器上传文件。为此,我创建了以下rest服务

代码

byte[] buff = new byte[10485760];
                using (FileStream fs = new FileStream("D:\\FileUpload\\" + "filename", FileMode.Create))
                {
                    int bytesRead = stream.Read(buff, 0, buff.Length);
                    while (bytesRead > 0)
                    {
                        fs.Write(buff, 0, bytesRead);
                        bytesRead = stream.Read(buff, 0, buff.Length);
                    }
                }
现在,我想在此服务中添加暂停和恢复功能。我读了一些文章,在内容范围hedaer的帮助下,我们可以查询从android mobile上传到服务器的字节数。 有谁能为我提供一个简单的上传rest服务,我可以暂停和恢复上传实用程序。 请帮助我在我的wcf rest服务中执行此暂停和恢复功能

我想从我的android移动应用程序中使用这个rest服务

我的android代码:

 HttpClient httpclient = new DefaultHttpClient();
                  HttpPost httppost = new HttpPost("http://192.168.2.44/Service1.svc/upload");
                  InputStreamEntity reqEntity = new InputStreamEntity(
                            new FileInputStream(new File(picturePath)), -1);
                    reqEntity.setContentType("binary/octet-stream");
                    reqEntity.setChunked(true); // Send in multiple parts if needed
                    httppost.setEntity(reqEntity);
                    response = httpclient.execute(httppost);