2016-03-17 17 views
0

我使用http://posttestserver.com/post.php从我的android设备使用改进测试多部分文件上传。我得到了如下成功响应:我在http://www.posttestserver.com/上传的文件在哪里?

Time: Wed, 16 Mar 16 23:14:04 -0700 
Source ip: 

Headers (Some may be inserted by server) 
REQUEST_URI = /post.php 
QUERY_STRING = 
REQUEST_METHOD = POST 
GATEWAY_INTERFACE = CGI/1.1 
REMOTE_PORT = 57241 
REMOTE_ADDR = 117.217.235.52 
HTTP_USER_AGENT = okhttp/3.0.1 
HTTP_ACCEPT_ENCODING = gzip 
HTTP_CONNECTION = close 
HTTP_HOST = posttestserver.com 
CONTENT_LENGTH = 610 
CONTENT_TYPE = multipart/form-data; boundary=b9c564cd-fcab-48fc-b034- 75ee43c0db90 
UNIQUE_ID = VupLLEBaMGUAAHKlJhoAAAAT 
REQUEST_TIME_FLOAT = 1458195244.3543 
REQUEST_TIME = 1458195244 

Post Params: 
key: 'description' value: 'hello, this is description speaking' 
Empty post body. 

== Multipart File upload. == 
Received 1 file(s) 
0: posted name=upload 
name: 1 
type: application/json 
error: 0 
size: 122 
Uploaded File: http://posttestserver.com/files/2016/03/16/f_23.14.04276262399 

上面的最后一行显示上传的文件。但打开此链接会显示上传文件的元数据。

{"headers":{"namesAndValues":["Content-Disposition","form-data; name=\"picture\"; filename=\"IMG-20160316-WA0004.jpg\""]}} 

在哪里可以找到实际上传的图片?

回答

0

尝试ION类它的工作正常。点击上面提到的链接时没有图像显示。

分享下面的代码。

   Ion.with(context) 
       .load("http://posttestserver.com/post.php").setLogging("MyLogs", Log.VERBOSE) 
       .uploadProgressBar(h.progress) 
       .setMultipartFile("archive", "image/*", new File(source.getPath())) 
       .asString() 
       .setCallback(new FutureCallback<String>() { 
        @Override 
        public void onCompleted(Exception e, String result) { 
         if (e != null) { 
          Log.e("Error Result", e.toString()); 
         } 
         Log.d("Result", result); 
        } 
       });