Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Problem with sessions & cookies
  • hi there,,

    the uploadify.. is just great..

    but i do have a problem with it... i don't know why i can't register any session or cookies on the upload.php page wich has been requested by uploadify

    here is the code

    $dsPath = substr( getcwd(),0,strlen(getcwd())-( strlen($dsCONF['DIR']['ADMN'])+1 ) ) . '/'. $dsCONF['DIR']['PIC'] . '/';
    $dsImgName = $ds->dsAdmin->dsUpload('Filedata',$dsPath,FALSE); // uploading the file then returning the generated name
    If (!$dsUpErr &amp;&amp; $dsImgName<>'None') { // if the image has been uploaded, store its name in the session
    $_SESSION['dsImgL'] = $dsImgName;
    }


    the same problem if i want to read the session in this page... to check if the user logged in or not.. it shows there is no session..

    but i request that page directly i do can read & write a sessions variables..
    thats why i guess its a bug in uploadify..

    any help with that would be great...

    i saw viewtopic.php?f=5&t=43 which solves the reading thing.. but what about the writing? i mean registering sessions and cookies on the upload.php page which called by uploadify


    thanks a lot..
  • With uploads Flash players create their own sessions. When the upload finishes the flash player terminates the session, which is why when you create a session in the upload.php you can not call on it from your calling script. Unfortunately this isn't a bug in Uploadify, but the way adobe have created their software. If you want to get to variables set in upload.php use the "response" facility to echo a string that you can parse in your calling file.
  • thanks for helping me out TravisN..

    If you want to get to variables set in upload.php use the "response" facility to echo a string that you can parse in your calling file.


    i'm not really good in javascript..
    i wonder if you can show me an example..

    thanks again bro
  • If you download the samples from the download page and look at the scriptData example. It throws back the name generated and displays it as an alert. As you seem to be just wanting one value from the upload script, all you need is this simple implementation.
  • i can't open this link http://www.uploadify.com/download/ even the demo or documentation..

    are you updating it or something...

    please if you can give the zip file link for scriptdata and the main uploadify archive..

    thanks a lot again
  • Until Ronnie can fix what's gone wrong here's the link to the collection sample.
  • thanks bro.. that would help :)
  • I had the same probs now fixed it...thank u all
  • <?php
    session_start();
    $id = session_id();
    echo "<script language='JavaScript'>
    $(document).ready( function () {

    $('#file_upload').uploadify({
    'uploader' : 'uploadify/uploadify.swf',
    'script' : 'uploadify/uploadify.php',
    'cancelImg' : 'uploadify/cancel.png',
    'folder' : 'uploads',
    'multi' : true,
    'method' : 'post',
    'scriptData' : { 'PHPSESSID': '".$id."'},

    'auto' : true,
    'fileExt' : '*.jpg;*.gif;*.png;*.php',
    'fileDesc' : 'Image Files (.JPG, .GIF, .PNG, .PHP)',
    'queueID' : 'custom-queue',
    'queueSizeLimit' : 1,
    'simUploadLimit' : 1,
    'removeCompleted': false,
    'onSelectOnce' : function(event,data) {
    $('#status-message').text(data.filesSelected + ' files have been added to the queue.');
    },
    'onAllComplete' : function(event,data) {
    $('#status-message').text(data.filesUploaded + ' fichiers envoyés, ' + data.errors + ' erreurs.');
    }
    });

    });
    </script>";

    ?>

    <div class="upload">
    <div id="status-message">Select some files to upload:</div>
    <div id="custom-queue"></div>
    <input id="file_upload" type="file" name="Filedata" />
    </div>



    then in uploadify.php


    <?php<br />$id = $_POST['PHPSESSID'];
    session_id($id);
    session_start();
    ?>