Is it possible? PLEASE HELP

Last post 09-10-2008 9:56 AM by ajay. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 11-21-2007 6:45 PM

    • bej34
    • Top 10 Contributor
    • Joined on 11-12-2007
    • Posts 44

    Is it possible? PLEASE HELP

    Is it possible to write a multipart form using cURL in the Nirvanix API? I have tried the following function but it only reads the first variable in the array.

     
    // Upload a Single File
        public function UploadFile($ipAddress, $uploadToken, $folder)
        {
            global $DEBUG;
            global $IMFSHOST;

            // Set the parameters
            //$folderPathParams = 'uploadToken=' . $uploadToken . '&';
            //$folderPathParams = $folderPathParams . 'destFolderPath=' . $folder . '&';
    $folderPathParams = array();
    $folderPathParams['destFolderPath'] = '@'.realpath($folder);
    $folderPathParams['uploadToken'] = $uploadToken;


            // retrieve from the REST interface the response xml.
            $xmlstring = curlFile('http://' . $ipAddress . '/Upload.ashx?' , $folderPathParams);
           
            if ($DEBUG)
            {
                print '<!--UploadFile: ';
                print_r($xmlstring);
                print '-->';
            }

            // turn into an object for easier handling.
            $xml = new SimpleXMLElement($xmlstring);
           
            return $xmlstring;
        }

     

     

    //The code is based on the other functions in the IMFS.php class file and the RestUtils.php file found in the File Manager application. Although I added the curlFile function (which just adds a few more cURL options. Thanks in advance for your help. 

    http://www.brianjinwright.com
  • 11-26-2007 7:00 PM In reply to

    Re: Is it possible? PLEASE HELP

    Greetings!

    Thanks for your question.

    I have forwarded your request to our Support Team for their review. 

    However, due to the increased volume of support requests from customers, our response times may be a bit longer at this time.

    Please bear with us while we for a short while longer.

    Thanks again,

    John Phillips - Customer Service Manager

  • 12-03-2007 9:09 PM In reply to

    Re: Is it possible? PLEASE HELP

    Greetings, BJ24

    I apologize for taking so long to provide you with an update on your request for assistance.

    We are still working through a backlog of requests for technical assistance, however, I have a meeeting set for late today w/ our CURL expert and I will have an answer for you by 11 AM (Pacific) tomarrow.

     Thanks in advance for your patience.

    John Phillips - Customer Service Manager

  • 12-04-2007 7:31 AM In reply to

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

    Re: Is it possible? PLEASE HELP

    <?php

        $post_data
    = array();
       
       
    $post_data['pictures[0]'] = "@cat.jpg";
       
    $post_data['pictures[1]'] = "@dog.jpg";
       

       
    $ch = curl_init();
       
    curl_setopt($ch, CURLOPT_URL, "http://my.domain.com/my_url.php" );
       
    curl_setopt($ch, CURLOPT_POST, 1 );
       
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
       
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
       
    $postResult = curl_exec($ch);

        if (
    curl_errno($ch)) {
           print
    curl_error($ch);
        }
       
    curl_close($ch);
        print
    "$postResult";
    ?>

    This is an example from the PHP Site which should answer your question.  External to the sample, our services should all take in standard headers in both GET and POST formats.  If you pass the $post_data as:

    param1=value1&param2=value2&param3=value3

    this will let you pass all of the values at once.

    Let me know if this answers your question.  The original URL where the above sample came from is: http://us2.php.net/curl

    Regards,
        Barry R.

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
    Filed under: ,
  • 09-10-2008 9:56 AM In reply to

    • ajay
    • Top 50 Contributor
    • Joined on 09-09-2008
    • Posts 8

    Re: Is it possible? PLEASE HELP

    how can i perform partial upload using curl. Any other method for partial upload. Please help
Page 1 of 1 (5 items)