Azure Sotarage on Android - open failed: ENOENT (No such file or directory)

0

I have a problem with the AZURE STORAGE API for Android which is when I try to upload an image with the following code

storageAccount = CloudStorageAccount.parse(storageConnectionString);
            CloudBlobClient blobClient = storageAccount.createCloudBlobClient();
            // Retrieve reference to a previously created container.
            CloudBlobContainer container = blobClient.getContainerReference("images");
            // Create the container if it does not exist
            container.createIfNotExists();
            // Create a permissions object
            BlobContainerPermissions containerPermissions = new BlobContainerPermissions();

            // Include public access in the permissions object
            containerPermissions.setPublicAccess(BlobContainerPublicAccessType.CONTAINER);

            // Set the permissions on the container
            container.uploadPermissions(containerPermissions);
            System.out.println("--- " + pathFile);

            // Create or overwrite the "myimage.jpg" blob with contents from a local file
            CloudBlockBlob blob = container.getBlockBlobReference(pathFile.toString());

            File source = new File(currImageURI.toString());
            blob.upload(new FileInputStream(source.getAbsolutePath()), source.length());

When System.out.println is in, the result is "/storage/emulated/0/Pictures/1489083183528.jpg" however I get the error immediately

java.io.FileNotFoundException: / content: / media / external / images / media / 602: open failed: ENOENT (No such file or directory)

Has anyone had this problem or do you know why this path appears instead of the other?

    
asked by anonymous 09.03.2017 / 19:52

1 answer

0

I solved my question the problem is that I was misunderstanding the path in this line of code CloudBlockBlob blob = container.getBlockBlobReference (pathFile.toString ());

    
10.03.2017 / 11:55