0

I am using the azure blob storage to copy the dropbox file. But when I try to copy that file via URL, got the 500 error and totalbytes are -1.

I am using StartCopy method of WindowsAzure.Storage.Blob package. But here I get the copyStatus.TotalBytes as -1 and copy not working.

Tried the all types of url as below:

So can you please help me to solve this issue? Anything needs to change in URL or any way to copy the dropbox media to azure blob storage.

Also, I am using the .net 4.8 frameworks with the C#.

Sample Code:

string url = "https://dl.dropboxu`enter code here`sercontent.com/s/1v9re1dozilpdgi/1_32min.mp4?dl=0";
            Uri fileUri = new Uri(url);
            string filename = "test-file.mp4";
            var account = CloudStorageAccount.Parse(connectionstring);
            var blobClient = account.CreateCloudBlobClient();            
            var container = blobClient.GetContainerReference("test-container");
            var blob = container.GetBlockBlobReference(filename);

            blob.DeleteIfExists();
            blob.StartCopy(fileUri);

            var refBlob = (CloudBlockBlob)container.GetBlobReferenceFromServer(filename);
            var fileLength = refBlob.CopyState.TotalBytes ?? 0;

            while (refBlob.CopyState.Status == CopyStatus.Pending)
            {
                refBlob = (CloudBlockBlob)container.GetBlobReferenceFromServer(filename);
                var copyStatus = refBlob.CopyState;

}

Error message: 500 InternalServerError "Copy failed."

3

1 Answer 1

0

We need to use CloudBlockBlob instead of using GetBlockBlobReference .

Because the filename, not the URL, is passed to GetBlockBlobReference in its Constructor.

For more information please refer the below

SO THREAD as suggested by @Tobias Tengler

& This BLOG:- Azure – Upload and Download data using C#.NET

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.