Azure / azure-storage-android

Microsoft Azure Storage Library for Android
Apache License 2.0
81 stars 47 forks source link

Is there support to get progress during a large file upload? #28

Open paolorotolo opened 8 years ago

paolorotolo commented 8 years ago

I'm using this method to upload some files on Blob (some files are large and take several minutes to upload).

    private void updateFilesOnBlob(){
        try {
            String timestamp = Tools.generateTimeStamp();

            // 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(CONTAINER_NAME);

            // Upload each file on Blob
            for (int i = 0; i< pathsArrayList.size(); i++) {
                // Define the path to a local file.
                final String filePath = pathsArrayList.get(i);
                CloudBlockBlob blob = container.getBlockBlobReference(timestamp + "/" + filenameFromPath(pathsArrayList.get(i)));
                File source = new File(filePath);
                blob.upload(new FileInputStream(source), source.length());
            }
        }
        catch (Exception e)
        {
            // Output the stack trace.
            e.printStackTrace();
        }
    }

As you can see, I use blob.upload() to start uploading the file. Is there any way to get the progress percentage and update the UI during the upload?

jofri-msft commented 8 years ago

Hello @PaoloRotolo ,

We do not currently have support for getting the progress as a percentage and can take this into consideration as a feature request. However there is support in the operation context to setResponseReceivedEventHandler() to notify you every time a put block call is made.

ManuBabu commented 7 years ago

Same reply, not able to get progress status.

manmohan556 commented 6 years ago

What about the put block list.How will i confirmed that image finally uploaded and i am ready to download.

niteshkejriwal commented 4 years ago

Do we have any further news here? Are we looking this to be implemented in near future?

chess92 commented 4 years ago

This would be helpful to have. I'm trying to wrap my brain around someone building an uploader where progress wasn't the first feature that was implemented LOL