I keep getting a file not found exception even though the path exists. The path is taken from were I originally created the file, so I assume the path is correct. The error happens at the FileInputStream mark below by error.
This is the error: W/System.err? java.io.FileNotFoundException: /file:/storage/emulated/0/footyman/img_1429035461315.jpg: open failed: ENOENT (No such file or directory)
public static void addProfilePic(final Uri path,final String imgName) { new AsyncTask<Void, Void, String>() { @Override protected String doInBackground(Void... par) { String done; try { // Retrieve storage account from connection-string. CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString); // Create the blob client. CloudBlobClient blobClient = storageAccount.createCloudBlobClient(); // Retrieve reference to a previously created container. CloudBlobContainer container = blobClient.getContainerReference("profilepics"); // Define the path to a local file. final String filePath = path.toString(); Log.i("filepath", filePath); // Create or overwrite the "myimage.jpg" blob with contents from a local file. CloudBlockBlob blob = container.getBlockBlobReference(imgName); File source = new File(path.toString()); // error here blob.upload(new FileInputStream(source.toURI().getPath()), source.length()); done = "true"; } catch (Exception e) { // Output the stack trace. done = "false"; e.printStackTrace(); } return done; } protected void onPostExecute(String done) { if (done.equals("true")) { Log.i("add pic", "success"); } else { Log.i("add pic", "failed"); } } }.execute(); } }