0

I have trouble with received data on server. I have android app which send data by multipartentity. I want to send two files (video and image). This is code from 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( );
}

Now how I can get data on my server and send back response to app that my server have this data?

Milad Nouri
  • 1,587
  • 1
  • 21
  • 32
kosmit
  • 621
  • 2
  • 7
  • 23

0 Answers0