Loading ...
Sorry, an error occurred while loading the content.

50944Uploader and PHPSESSID

Expand Messages
  • darrellgrundy
    Aug 3, 2009
    • 0 Attachment
      Love the client side uploader, but pulling my hair out trying to get the PHP server side working maintaining the user's existing session ID. I have it working in its basic form uploading files to a specific static folder path, but of course this will be no good to me unless I can dynamically route the files to the logged-in user's file storage area.

      I have read a few other posts on the subject (specifically this one) and seems the solution revolves around echo'ing the user's session ID into the initial upload photos html page which will then be passed back to the server side PHP script (via uploader.uploadAll). OK, seems logical. The server-side script can then pull this out of the post with a
      session_id($_POST['PHPSESSID']).

      This is where I come unstuck. I have a couple of problems:

      1. Inserting the PHPSESSID value into the uploader.uploadAll call html, for me this stops the 'Upload Files' function from working [re: Uploader Control (beta): Advanced Uploader Example With Transparent UI and Automatic Queue Management]. If I try to do it literally as per other post examples with a php function line such as:

      echo 'uploader.uploadAll("http://site.com/photo_upload.php", "POST", {PHPSESSID: ';
      echo session_id();
      echo '}, "Filedata")';

      ... this works and the client html source has the session id inserted as expected, however when y
      ou select your files, click upload and it sits there without updating the red progress bar(s). It seems to be the curly braces around the PHPSESSID which causes the problem. If I replace curly braces with double quotes, then the upload functionality works OK, however the server side script, e.g.

      <?php

      session_id
      ($_POST['PHPSESSID']);
      session_start();

      $user = User::getLoggedIn();

      foreach ($_FILES as $fieldName => $file) {
        move_uploaded_file($file['tmp_name'], "uploads/" . $user->username . "/files/" . strip_tags(basename($file['name'])));
        echo (" ");
      } ?>

      ... does not work in moving the files to the logged-in user's directory. I have tried another temp hack (as used for another flash-based uploader) to assign a temporary user_id value in the session variables (replacing the Facebook User::getLoggedIn code above - which worked for the other solution), however, nothing that I do for the Yahoo Uploader has resulted in being able to resume the user's session ... and I have been problem solving this for the best part of 2 days now. If anybody has an helpful thoughts on the matter then this would be greatly appreciated.

      2. The other strange situation during problem solving was running the client browser via proxy application (Paros) to see what calls are being made. When I click on the 'Upload Files' link to transfer the files, I see no web browser requests to the server?? I presume this has something to do with the flash file doing the uploading? But I would still have thought that the request would go from the browser and allow me to see what is POST'ed etc? Weird.

      Thanks.

      Darrell



    • Show all 4 messages in this topic