locked
How to upload files from local drive to azure blob using webclient upload method RRS feed

  • Question

  • I want  to upload files from my local machine to windows azure containers using webclient upload method    

       
    UploadFile(Uri, String)



    I dont want to use any cloud or azure API's to upload, reason being i am uploading files from Sql server integration services which does not support any cloud API's, so please can i know is their any way out upload the file to azure container without using any of the cloud API's
    Friday, January 20, 2012 4:48 AM

Answers

  • Essentially Windows Azure SDK is a wrapper over a REST based API (http://msdn.microsoft.com/en-us/library/dd179355.aspx) where each operation including uploading blobs is exposted as a URL. What you could do is call those URLs using your WebClient upload method (I have not tried it though). A few things you would need to keep in mind:

    1. You would need to specify certain request headers when invoking the REST API. If you're using WebClient, please ensure that you're passing all the required headers.

    2. I think the better option would be using WebClient.UploadData() or UploadDataAsync() instead of UploadFile().

    3. There is a 4 MB limit for each call to storage service. If your file size is more than 4 MB, you would need to break it in chunks.

    4. IMHO, HttbWebRequest/HttpWebResponse would be better alternative than using WebClient. For our products, we actually use that.

    You may want to check out http://azurestoragesamples.codeplex.com/ which has some source code for using REST API.

    Hope this helps.

    Thanks

    Gaurav Mantri

    Cerebrata Software

    http://www.cerebrata.com

     

     

    • Marked as answer by Mahesh Nayak Friday, January 20, 2012 8:12 AM
    Friday, January 20, 2012 7:59 AM

All replies

  • Mahesh Nayak,

    Your question isn't quite clear. Based on my understanding, I will explain them.

    If you don't want to use any APIs to use them (Azure .net SDK  and REST) for the reasons you have given, the way the left out is to use any tools for the upload.

    Few tools

    http://azurestorageexplorer.codeplex.com/ [Free and open source]

    http://www.cloudberrylab.com/free-microsoft-azure-explorer.aspx

    More details here

    http://blogs.msdn.com/b/windowsazurestorage/archive/2010/04/17/windows-azure-storage-explorers.aspx

     

    Friday, January 20, 2012 7:47 AM
  • Hi Navcode,

    Thanks for the reply, i am already using azure storage explorer, i dont want to upload files physically , i want to do this through code using some REST API's as you suggested

     

     

     

    Thanks,

    Mahesh


    Mahesh
    Friday, January 20, 2012 7:56 AM
  • Essentially Windows Azure SDK is a wrapper over a REST based API (http://msdn.microsoft.com/en-us/library/dd179355.aspx) where each operation including uploading blobs is exposted as a URL. What you could do is call those URLs using your WebClient upload method (I have not tried it though). A few things you would need to keep in mind:

    1. You would need to specify certain request headers when invoking the REST API. If you're using WebClient, please ensure that you're passing all the required headers.

    2. I think the better option would be using WebClient.UploadData() or UploadDataAsync() instead of UploadFile().

    3. There is a 4 MB limit for each call to storage service. If your file size is more than 4 MB, you would need to break it in chunks.

    4. IMHO, HttbWebRequest/HttpWebResponse would be better alternative than using WebClient. For our products, we actually use that.

    You may want to check out http://azurestoragesamples.codeplex.com/ which has some source code for using REST API.

    Hope this helps.

    Thanks

    Gaurav Mantri

    Cerebrata Software

    http://www.cerebrata.com

     

     

    • Marked as answer by Mahesh Nayak Friday, January 20, 2012 8:12 AM
    Friday, January 20, 2012 7:59 AM