我在服务器上收到的数据有问题。我有Android应用程序,通过multipartentity发送数据。我想发送两个文件(视频和图像)。 这是来自android的代码:
protected void uploadStuff(String videoPath, String backgroundPath, String Url) throws ParseException, IOException {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(Url);
FileBody filebodyVideo = new FileBody(new File(videoPath));
FileBody filebodyBackground = new FileBody(new File(backgroundPath));
MultipartEntity reqEntity = new MultipartEntity();
reqEntity.addPart("File", filebodyVideo);
reqEntity.addPart("backgroundFile", filebodyBackground);
httppost.setEntity(reqEntity);
Log.d("executing request ", httppost.getRequestLine().toString());
HttpResponse response = httpclient.execute( httppost );
HttpEntity resEntity = response.getEntity( );
Log.d("Response - Status Line", response.getStatusLine().toString());
if (resEntity != null) {
Log.d("Entity Utils ", EntityUtils.toString(resEntity));
}
if (resEntity != null) {
resEntity.consumeContent( );
}
httpclient.getConnectionManager( ).shutdown( );
}
现在我如何在我的服务器上获取数据并将响应发送回我的服务器拥有此数据的应用程序?