0

I currently have a web role which displays a webpage, the webpage allows the user to select a file from their computer, the web role then uploads the file to some Azure Blob Storage.

However the file the user usually uploads is a zip file so i would like to unzip the file and extract the contents and then upload the contents to the Azure Blob Storage.

I have attempted to do this by using the SharpZipLib example I found here

http://blog.logiclabz.com/c/unzip-files-in-net-c-using-sharpziplib-open-source-library.aspx

I have add the references to my web role for the ICSharpCode.SharpZipLib.dll file and the ZipOperations.dll however I am still receiving the following errors; enter image description here

Another thing I am confused about is when I am calling UnZipFile(...); what would be the directory of the file I am uploading, would it be the ID of the form which the file is selected in.

Thanks in advance, Sami.

Sami
  • 1,374
  • 1
  • 16
  • 43

1 Answers1

1

The ZIP file should be uploaded to your web role local disk first, let's say you saved it in a local resource. Then you can invoke the SharpZip to extract the content to some other local resource, then finally upload the content files to the BLOB.

Regarding the windows azure local resource, please have a look http://msdn.microsoft.com/en-us/library/windowsazure/ee758708.aspx

Regarding your errors it looks like you didn't add necessary "using" statements at the beginning of your code. For example you need "using System.IO" then you can use File, Directory, etc. in your code.

Shaun Xu
  • 4,476
  • 2
  • 27
  • 41
  • Thanks for your response, I have been able to get the code working so that I can now upload a zip file to the local storage, the contents of the zip file are then extracted into the local storage and the zip file is deleted, I would appreciate if you could help me with uploading multiple files from the local storage to the blob storage. – Sami Mar 05 '12 at 02:31
  • 1
    See my answer http://stackoverflow.com/questions/9560982/upload-all-files-from-local-storage-to-azure-blob-storage/9561092#9561092 – Shaun Xu Mar 05 '12 at 02:58