Define filename via desFolderPath

Last post 03-31-2008 8:07 PM by BarryR. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 03-27-2008 12:55 PM

    Define filename via desFolderPath

    Hi

    Im uploading directly to Nirvanix and it is working great.

    But I cannot define the name of my uploading file directly in the variable "desFolderPath" like it is showned in this example from the documentation:

    http://node1.nirvanix.com/upload.ashx?uploadToken=ASdsdasd11233&destFolderPath=Photos/Vacations/2007Hawaii/DSC231256.jpg&forwardingUrl=www%2Egoogle%2Ecom%2Fsearch%3Fhl%3Den%26safe%3Doff%26pwst%3D1%26sa%3DX%26oi%3Dspell%26resnum%3D0%26ct%3Dresult%26cd%3D1%26q%3Ddogs%2Bcats%26spell%3D1%0D%0A

    Documentation link: http://developer.nirvanix.com/sitefiles/1000/API.html#_Toc175999952

    So my question is, is it posible to define the filename of the file im uploading via desFolderPath?

     Thanx!

     

  • 03-27-2008 2:40 PM In reply to

    • BarryR
    • Top 10 Contributor
    • Joined on 07-20-2007
    • San Diego
    • Posts 630

    Re: Define filename via desFolderPath

    It is possible but the web browser does not allow it.  Let me go over how the filename is derived and why it has to be associated with each file.

    When doing an upload we have to allow for multiple files to be defined.  This would be used if you have multiple file input types on an html form that the user can submit at once.  The browser tells us about each file right before that file in the body of the data being sent.  I have copied what the browser sends to us on a multi-file upload:

    -----------------------------170062046428149\r\n
    Content-Disposition: form-data; name="fileContent"; filename="myfile1.dat"\r\n
    Content-Type: binary/octet-stream\r\n
    \r\n
    0xf0 0xf1 0xf2 0xf3 0xf4\r\n
    -----------------------------170062046428149\r\n
    Content-Disposition: form-data; name="fileContent"; filename="myfile2.dat"\r\n
    Content-Type: binary/octet-stream\r\n
    \r\n
    0xf0 0xf1 0xf2 0xf3 0xf4\r\n
    -----------------------------170062046428149\r\n
    Content-Disposition: form-data; name="fileContent"; filename="myfile3.dat"\r\n
    Content-Type: binary/octet-stream\r\n
    \r\n
    0xf0 0xf1 0xf2 0xf3 0xf4\r\n
    -----------------------------170062046428149--\r\n


    Because each file is defined by the browser as its being sent this limits how we name the file. You always have the option of creating the http upload headers yourself and setting the above filename in the Content-Disposition. Since this is just a side effect of the protocol and allowing the client to work on their own there isn't much you can do.

    Please let me know if this is not clear.

    Regards,
    Barry R.

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
  • 03-28-2008 8:25 AM In reply to

    Re: Define filename via desFolderPath

    Hi

    So I have to change the filename in the Content-Disposition of the header?

    By the way we are only posting one file at the time.

     

  • 03-31-2008 8:07 PM In reply to

    • BarryR
    • Top 10 Contributor
    • Joined on 07-20-2007
    • San Diego
    • Posts 630

    Re: Define filename via desFolderPath

    teleskop:
    So I have to change the filename in the Content-Disposition of the header?
     

     
    Yes, this is the standard for HTTP Uploads.  Please let me know if you have any trouble with this or the HTTP Protocol in general.  You can read more about HTTP uploads in the RFC: http://www.ietf.org/rfc/rfc1867.txt. We also have tried to identify information to make doing HTTP Uploads easier and have put them in our API Document at: http://developer.nirvanix.com/sitefiles/1000/API.html#_Toc175999901

    Regards,
        Barry R.

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
Page 1 of 1 (4 items)