如何在服务器上上传大视频文件? 我想要高达50至60mb的视频文件在服务器上,但我不知道它是如何可能的。我无法在服务器上上传最多15MB的视频文件。请有任何解决方法然后让我知道。如何在服务器上上传大视频文件?
公共静态字符串postRequestvideo_test(字符串URL,字节[]视频, 的byte []的图像,列表数据){
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;
}
请更具体一点 - 您在上传过程中遇到了什么问题? – Okas 2014-10-02 10:31:11
我发送视频文件为字节数组,内存错误。 – 2014-10-02 10:34:25
什么是回应,你如何接听电话?请尽可能详细地提供详细信息。 – Okas 2014-10-02 10:36:33