1. Are you ready for the Galaxy S20? Here is everything we know so far!

how to upload videos to DailyMotion??

Discussion in 'Android Development' started by nivie, Dec 21, 2011.

  1. nivie

    nivie Newbie
    Thread Starter

    Hi,
    I am trying to upload videos to DailyMotion. It is giving internal server error.
    I am not able to remove this error. I am giving the code i am using here.

    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost("http://www.dailymotion.com/upload");
    ProgressMultipartEntity multipartentity = new ProgressMultipartEntity(this);
    try {
    multipartentity.addPart("file", new FileBody(videoFile));

    multipartentity.addPart("title", new StringBody(title));
    multipartentity.addPart("post", new StringBody("1"));
    multipartentity.addPart("skin", new StringBody("api"));
    httppost.setEntity(multipartentity);
    System.out.println(" httppost: "+httppost.getURI());
    HttpResponse httpresponse = httpclient.execute(httppost);
    HttpEntity responseentity = httpresponse.getEntity();
    System.out.println(" httpresponse: "+httpresponse+" responseentity: "+responseentity);
    if (responseentity != null) {

    InputStream inputstream = responseentity.getContent();
    if(httpresponse.getStatusLine().getStatusCode()!=500)
    upload=true;

    inputstream.close();
    }
    }
    catch (ClientProtocolException e) {
    e.printStackTrace();
    }
    catch (IOException e) {
    e.printStackTrace();
    }


    Please help.
    Thanks in advance.
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...

Share This Page

Loading...