我想使用post将文件上传到服务器php 继承我的代码
String url = "http://blabla.com/upload.php";
File file = new File(Environment.getExternalStorageDirectory(),
"Myfile.log");
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
InputStreamEntity reqEntity = new InputStreamEntity(
new FileInputStream(file), -1);
reqEntity.setContentType("binary/octet-stream");
reqEntity.setChunked(true); // Send in multiple parts if needed
httppost.setEntity(reqEntity);
HttpResponse response = httpclient.execute(httppost);
//Do something with response...
}
我的问题是如何在PHP上处理它?如果它在$_FILES
数组中,那么我应该使用什么ID将其放入uploads文件夹($_FILES['whatShouldBeHere']
)?谢谢。