I have been banging my head for a couple of days, browsing the internet for some answer but so far nothing... I am working on an android app which I need it to upload a video to a php server. I tested with image and audio, both work but the video I can not get it working... It seems like it is passing nothing, here is the code (I am using apache). The variables declarations:
public static File mediaStorage = new File(
Environment
.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM),
"Camera");
public static File video = new File(mediaStorage.getPath() + File.separator
+ "20131103_105102.mp4");
String ture = video.toString();
now the method:
public void uploadFile() {
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost("http://server");
MultipartEntity reqEntity = new MultipartEntity();
reqEntity.addPart("uploaded_file", new FileBody(video));
post.setEntity(reqEntity);
try {
HttpResponse response = client.execute(post);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
dialog.dismiss();
}
not doing anything, now if I put an image path or an audio path, everything works well... What am I doing wrong?