0

I am using SWFuploader with Jquery and PHP(Zend framework) for uploading

http://code.google.com/p/swfupload/

I am facing a problem while using sessions.
There is 3 step login wizard, 1st step is simple form and uplaoder is on 2nd step. Flow of application is, It stores 1st step data in session after submitting and redirect to 2nd step. When I try to upload some files and try to use data stored in session, it gives me nothing.

I am using this code :
JS Code

var settings = {
        flash_url : "/javascript/flash/swfupload.swf",
        upload_url: "/login/uploaditems", 
        post_params: {
                      'session' : <?php echo session_id;?>
                 },
        file_size_limit : "1 MB",
    file_types : "*.pdf;",
    file_types_description : "All Files",
    file_upload_limit : 100,
    file_queue_limit : 10,
    custom_settings : {
        cancelButtonId : "cancelBtn"
    },
    debug: false,
    button_image_url: "/images/chooseButton-2.png",

    // The event handler functions are defined in handlers.js
    file_queued_handler : fileQueued,
    file_queue_error_handler :fileQueueError,
    file_dialog_complete_handler : fileDialogComplete,
    upload_start_handler : uploadStart,
    upload_progress_handler : uploadProgress,
    upload_error_handler : uploadError,
    upload_success_handler : uploadSuccess,
    upload_complete_handler : uploadComplete,
    queue_complete_handler : queueComplete  // Queue plugin event
};

Swfu1 = new SWFUpload(settings);

PHP Code :

 if(isset($params['session'])) {
        session_id($params['session']);
    }
 $uploadedFilesSession = new Zend_Session_Namespace('uploadedFiles'.$params['session']);
    if(!isset($uploadedFilesSession->files))
    {
        $uploadedFilesSession->files = array();
    }
    if(!isset($uploadedFilesSession->files[$flag])){
        $uploadedFilesSession->files[$flag] = array();
    }  

Everytime it goes in condition !isset($uploadedFilesSession->files) and reset my authentication session too. It is only happening in Safari.

Please guide me.

2
  • Is this code running in an iframe by any chance? Feb 11, 2013 at 13:20
  • I didn't check it in Iframe. Is there any possibility that this code may run in Iframe. Feb 11, 2013 at 16:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.