apache上传文件

来源:互联网 发布:sql新增数值字段语句 编辑:程序博客网 时间:2024/05/21 11:23
*  File f = new File("/path/fileToUpload.txt");*  PostMethod filePost = new PostMethod("http://host/some_path");*  Part[] parts = {*      new StringPart("param_name", "value"),*      new FilePart(f.getName(), f)*  };*  filePost.setRequestEntity(*      new MultipartRequestEntity(parts, filePost.getParams())*      );*  HttpClient client = new HttpClient();*  int status = client.executeMethod(filePost);
0 0