废话少说直接上代码
File file=new file(path);
FileInputStream in = new FileInputStream(file);
byte[] b=new byte[in.available()]
HttpPut httpPut = Header.getHeader(url);
HttpClient client = HttpClientFactory.createHttpClient();
httpPut.setEntity(new ByteArrayEntity(b));
HttpResponse response = client.execute(httpPut);
HttpEntity entity = response.getEntity();
String string = EntityUtils.toString(entity);
public class Header{
public static HttpPut getHeader(String url){
HttpPut httpPut=new HttpPut(url);
//内容没有填充
httpPut.setHeader("","");
httpPut.setHeader("","");
httpPut.setHeader("","");
return httpPut;
}