need help urgent

Last post 07-26-2008 5:56 AM by BarryR. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 07-25-2008 3:23 PM

    • fanton
    • Top 75 Contributor
    • Joined on 07-25-2008
    • Posts 4

    need help urgent

     Hi

     

    I am trying to modify upload.php from PHP File System so that I can have a n sql insert into my own database every time I upload something to nirvanix. I am doing that by replacing the normal upload.php action witha custom action which first does the sql insert then second forwards the hidden fields + file data using curlPost to a nirvanix node . it should work but it doesn't. i get a response code 100. missing fields. i m missing all the authentification fields.

    regards

    filip

    Filed under: , ,
  • 07-25-2008 3:36 PM In reply to

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

    Re: need help urgent

     Would you mind posting the code (excluding application key, username and password) so we can take a look.  It sounds like you may just have a bit of a logic error.

    Regards,
           Barry R.

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
  • 07-25-2008 3:55 PM In reply to

    • fanton
    • Top 75 Contributor
    • Joined on 07-25-2008
    • Posts 4

    Re: need help urgent

    as i said i changed upload.php form it now looks like this. note i have added a one more hidden field (the ones with ***)

    <div class="container">
                <h4>Upload File to: <?php echo htmlspecialchars($path); ?></h4>
                <form ENCTYPE="multipart/form-data" action="myPost.php" method="post">
                    <input type="hidden" name="uploadToken" value="<?php print $accessToken; ?>"/>
                    <input type="hidden" name="destFolderPath" value="<?php print $path ?>"/>
                    <input type="hidden" name="forwardingUrl" value="http://<?php print $_SERVER['SERVER_NAME']; ?>/S4Tek/NirvanixSystemManager/browse.php?path=<?php print $path; ?>"/>
                    ***<input type="hidden" name="ipAddress" value="<?php print $ipAddress; ?>"/>
                    <LABEL for="uploadFile1">File: </LABEL>
                    <input type="file" name="uploadFile"/><br>
                    <input type="submit" value="Upload" /><input type="button" value="Cancel" onClick="BLOCKED SCRIPThistory.back();" />
                </form>
                </div>
    <?php

     

     myPost.php is the custom action . connectdb.php is a class that deals with interacting with my sql data. it works i have tested it. all i need now is to correctly forward the form data from above trough the function below towards node1.nirvanix.com/upload.ashx (or maybe a different node)

    <?php

        require_once "connectdb.php";
        require_once "NirvanixAPI/RestUtils.php";
       

        $ipAddress = $_REQUEST['ipAddress'];
        $forwardingUrl = $_REQUEST['forwardingUrl'];
        $destFolderPath = $_REQUEST['destFolderPath'];
        $uploadToken = $_REQUEST['uploadToken'];
       
        $connectdb = new Connectdb(); //mysql object
        //$connectdb->insertAsset($_FILES['uploadFile']['name'] , $destFolderPath, $_FILES['uploadFile']['size']);
       
        $url = 'http://' . $ipAddress . '/Upload.ashx';
       
        $data = array('uploadToken'=>$accessToken,
                  'destFolderPath'=>$destFolderPath,
                  'forwardingUrl'=>$forwardingUrl,
                  'uploadFile'=>@$_FILES['uploadFile']);
       
        $response = curlPost($url, $data);
           print $response;
          
    ?>

     

    thank you very much for your prompt response

     

     

  • 07-25-2008 4:45 PM In reply to

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

    Re: need help urgent

     As an experiment try:


        $url = 'http://' . $ipAddress . '/Upload.ashx?uploadToken=' . $accessToken . '&destFolderPath=' . $destFolderPath . '&forwardingURL=' . $forwardingUrl;
       
        $data = array('uploadFile'=>@$_FILES['uploadFile']);
       
        $response = curlPost($url, $data);
           print $response;

    I'm guessing there is a problem with the curlpost method.

    Let me know if this helps.

    Regards,
          Barry R.

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
  • 07-25-2008 5:13 PM In reply to

    • fanton
    • Top 75 Contributor
    • Joined on 07-25-2008
    • Posts 4

    Re: need help urgent

    hi. i tried that it doesn't help

    i still get the same error Response 100 missing app key. i guess it has to do with login session. when i forward like that i m not logged in anymore?

    <!--Login: <?xml version="1.0" encoding="utf-8"?>
    <Response>
    <ResponseCode>100</ResponseCode>
    <ErrorMessage>Missing Required Parameter: appKey, username, password</ErrorMessage>
    </Response>
    https://services.nirvanix.com/ws/Authentication/Login.ashx?username=&password=&appKey=-->
    <!--ListFolder: <?xml version="1.0" encoding="utf-8"?>
    <Response>
    <ResponseCode>100</ResponseCode>
    <ErrorMessage>Missing Required Parameter: sessionToken</ErrorMessage>
    </Response>-->
    </Response>
    i m using curlPost function included in NirvanixAPI/RestUtils.php

     

  • 07-25-2008 5:25 PM In reply to

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

    Re: need help urgent

    I think I understand the problem, the scripts for the application use $_SESSION variables to hold the appkey, username and password.  It looks like those variables are not being retained.  Can you verify the $_SESSION variables work?  Also make sure you do session_start() at the beginning of the file.

    Regards,
          Barry R.

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
  • 07-25-2008 5:46 PM In reply to

    • fanton
    • Top 75 Contributor
    • Joined on 07-25-2008
    • Posts 4

    Re: need help urgent

    the session variables are there

    to me i feel its not actually sending it as Post properly since i noticed there is a redirect url back to browse.php. that never happens. i click upload the form goes to action myPost.php..and it hangs there. if i add $response  = curlPost(url, vars) echo $response it shows a broken version of upload.php with missing session variable. otherwise if i take echo $response it shows a blank page.

     

  • 07-26-2008 5:56 AM In reply to

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

    Re: need help urgent

    I am noticing some interesting behavior as well with the forwarding URL.  I will post here when I have a better answer for you.

    Regards,
          Barry R. 

    IM Support (Feel free to add me)

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