码迷,mamicode.com
首页 > Web开发 > 详细

http文件传输

时间:2017-05-23 15:47:58      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:log   cli   client   pcl   使用   class   cut   disk   color   

上传端:
File uploadFile =new File();
PostMethod mPost = null;
try{
    String targetURL =";
    HttpClient client = new HttpClient();
    mPost = new PostMethod(targetURL);
    Part [] part = {new FilePart(uploadFile.getName(), uploadFile)};
    mPost.setRequestEntity(new MultipartRequestEntity(part,mPost.getParams()));
    mPost.setRequestHeader("cookies", "");
    client.executeMethod(mPost);
    if(mPost.getStatusCode()==200){ } 
}

接受端:

使用

DiskFileItemFactory factory = new DiskFileItemFactory();

http文件传输

标签:log   cli   client   pcl   使用   class   cut   disk   color   

原文地址:http://www.cnblogs.com/yuxin299/p/6894135.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!