如何在服務器上上傳大視頻文件? 我想要高達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