How to Upload Large Video FIle on server? I want up to 50 to 60mb video File on Server but I dont know how its possible. I could not Upload up to 15mb video file on server. Please have any solution Then let me know.
public static String postRequestvideo_test(String url, byte[] video, byte[] image, List data) {
String result = "";
Log.i("video_upload", video + "");
try {
HttpPost httpPost = new HttpPost(url);
// StringEntity se;
// se = new StringEntity(data, HTTP.UTF_8);
// httpPost.setEntity(new UrlEncodedFormEntity(data));
httpPost.setEntity(new UrlEncodedFormEntity(data, "UTF-8"));
MultipartEntity mpEntity = new MultipartEntity(
HttpMultipartMode.BROWSER_COMPATIBLE);
mpEntity.addPart("video_thumbnail", new ByteArrayBody(image,
"imagename" + ".jpeg"));
mpEntity.addPart("video",
new ByteArrayBody(video, "hyman" + ".mp4"));
mpEntity.addPart("user_key", new StringBody("user_key_test"));
mpEntity.addPart("video_name", new StringBody("video_name_test"));
mpEntity.addPart("video_duration", new StringBody(
"video_duration_test"));
mpEntity.addPart("video_thumbnail_extn", new StringBody(
"video_thumbnail_extn_test"));
httpPost.setEntity(mpEntity);
HttpParams httpParameters = new BasicHttpParams();
int timeoutConnection = 90000000;
HttpConnectionParams.setConnectionTimeout(httpParameters,
timeoutConnection);
int timeoutSocket = 90000000;
HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);
DefaultHttpClient httpClient = new DefaultHttpClient(httpParameters);
BasicHttpResponse httpResponse = (BasicHttpResponse) httpClient
.execute(httpPost);
HttpEntity entity = httpResponse.getEntity();
if (entity != null) {
result = EntityUtils.toString(entity);
result = result.trim();
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
return "-333" + e.toString();
}
return result;
}