我想通过Android将视频上传到app引擎(blob商店)。目前在运行时,没有任何反应(只有线程正在执行,但我在运行时会收到警告:
VFY: unable to resolve static field 2678 (INSTANCE) in Lorg/apache/http/message/BasicHeaderValueParser;
有什么想法可以解决这个问题吗?
谢谢!
FileBody的文件路径:
/storage/emulated/0/test/djfff_20140219.mp4
这是我的JSP:
<%@ page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory" %>
<%@ page import="com.google.appengine.api.blobstore.BlobstoreService" %>
<%
BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
%>
<html>
<head>
<title>Upload video</title>
</head>
<body bgcolor="FDF9FD">
<br><br><br><br><br><br><br><br><br>
<form action="<%= blobstoreService.createUploadUrl("/uploadUrl") %>" method="post" enctype="multipart/form-data">
<table align="center">
<th>Selecteer video
<input type="text" name="foo">
<input type="file" name="myFile">
</th>
<tr>
<td> <input type="submit" value="Submit"></td>
</tr>
</table>
</form>
</body>
</html>
这是我在Android中的主题:
private static class uploadVideo extends AsyncTask<Void, Void, Void>{
String selectedPath;
public uploadVideo(String selectedPath) {
this.selectedPath = selectedPath;
System.out.println(selectedPath);
}
@Override
protected Void doInBackground(Void... params) {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.kinevub.appspot.com/video_upload.jsp");
FileBody filebodyVideo = new FileBody(new File(selectedPath));
MultipartEntity reqEntity = new MultipartEntity();
reqEntity.addPart("myFile", filebodyVideo);
httppost.setEntity(reqEntity);
try {
httpclient.execute(httppost);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
}
}