Android : File source not exist - Android

on Thursday, October 9, 2014


Someone can help me. I have this problem : i have two file ButtonListener.java and controllerActivity.java. These are the following content :


1- ButtonListener : ... int x = content.uploadFile(content.getRapport().getSignature(), MainActivity.IP); content.makeToast(""+x+" "+content.getRapport().getSignature()); ...


2- controllerActivity : ... public int uploadFile(String sourceFileUri,String ipServer) { String upLoadServerUri = "http://"+MainActivity.IP+"/Livingstone/services/upload_file.php"; String fileName = sourceFileUri; HttpURLConnection conn = null; DataOutputStream dos = null; String lineEnd = "\r\n"; String twoHyphens = "--"; String boundary = "*****"; int bytesRead, bytesAvailable, bufferSize; byte[] buffer; int maxBufferSize = 1 * 1024 * 1024; File sourceFile = new File(sourceFileUri);



if(!sourceFile.isFile()){
Log.e("upload file", "Source file not exist");
runOnUiThread(new Runnable() {


……………..


THE PROBLEM : uploadFile() also return 0. note that content.getRapport().getSignature() return /mnt/sdcard/DCIM/Camera/signature_image23465.jpg.


THANKS FOR RESP.


0 comments:

Post a Comment