Android-POST multipart form data

Я хотел бы отправить составную форму с видео и данными, такими как адрес электронной почты и имя. Ниже приведен мой код, он не работает, от сервера нет ответа

File file =new File(VideoPath);
    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost(url);

        try {
            // Add your data
            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
            nameValuePairs.add(new BasicNameValuePair("Name", "LDGHT"));
            nameValuePairs.add(new BasicNameValuePair("Email", "hhh@example.com"));

            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
            httppost.setEntity(new FileEntity(file, "video/mp4"));

            // Execute HTTP Post Request
            HttpResponse response = httpclient.execute(httppost);

        } catch (ClientProtocolException e) {
            // TODO Auto-generated catch block
        } catch (IOException e) {
            // TODO Auto-generated catch block
        }
16
задан dakshbhatt21 27 July 2013 в 06:36
поделиться