Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Azure: Can't upload a 34 MB file on to the blob

I was trying to upload a 34 MB file onto the blob but it is prompting me some error

    XML Parsing Error: no element found
Location: http://127.0.0.1:83/Default.aspx
Line Number 1, Column 1:

What should I do....How to solve it


I am able to upload small files of size 500KB.. but I have a file of size 34 MB to be uploaded into my blob container

I tried it using

protected void ButUpload_click(object sender, EventArgs e)
        {
            // store upladed file as a blob storage
            if (uplFileUpload.HasFile)
            {
                name = uplFileUpload.FileName;
                // get refernce to the cloud blob container
                CloudBlobContainer blobContainer = cloudBlobClient.GetContainerReference("documents");

                // set the name for the uploading files
                string UploadDocName = name;

                // get the blob reference and set the metadata properties
                CloudBlob blob = blobContainer.GetBlobReference(UploadDocName);
                blob.Metadata["FILETYPE"] = "text";
                blob.Properties.ContentType = uplFileUpload.PostedFile.ContentType;

                // upload the blob to the storage
                blob.UploadFromStream(uplFileUpload.FileContent);

            }
        } 

But I am not able to upload it.. Can anyone tell me How to do that....

like image 406
veda Avatar asked Apr 12 '10 16:04

veda


3 Answers

Blobs larger than 64MB must be uploaded using block blobs. You break the file into blocks, upload all the blocks (associating each block with a unique string identifier), and at the very end you post the list of block IDs to the blob to commit the entire batch in one go.

Uploading in blocks is also recommended for large blobs less than 64MB in size. It is very easy for a hiccup in the network connection or routing through the internet to lose a frame or two in a very large upload, which will corrupt or invalidate the entire upload. Use smaller blocks to reduce your exposure to cosmic events.

More info in this discussion thread: http://social.msdn.microsoft.com/Forums/en-NZ/windowsazure/thread/f4575746-a695-40ff-9e49-ffe4c99b28c7

like image 140
dthorpe Avatar answered Nov 02 '22 08:11

dthorpe


I would start by dropping some logging into the project to try and track the problem down. It may not be happening where you think. There might also be a permissions error. Try adding some dummy data into the database. If it still fails that might be a potential problem.

But track it down yourself with some debug, logging and some code review, I bet you can get to the bottom of the problem sooner that way. And it will also help to make your code more robust.

like image 32
Kaili Avatar answered Nov 02 '22 08:11

Kaili


You can use Blobs here. I think its an issue with your web request size. You can change this setting in the web.config by increasing the number of the maxRequestLength attribute in the element. If you are sending chunks of 500Kb, then you are wasting bandwidth and bringing down performance. Send bigger chunks of data such as 1-2 Mb per chunk. See my Silverlight or HTML5 based upload control for chunked uploads. Pick Your Azure File Upload Control: Silverlight and TPL or HTML5 and AJAX

like image 34
Rahul Avatar answered Nov 02 '22 08:11

Rahul