jQuery and Uploadify session in the php file

By : Henrikz
Source: Stackoverflow.com
Question!

Ok, so i've just getting started on a verry new project, when this problem suddenly came up. The upload works fine, and I'm able to move/replace and edit the filenames of the pictures that has been uploaded.

But, when i try to assign a variable to a session, that already has been created when you login as a user, it doesn't show. It looks like the sessions is not created, how come this is not working? Maybe I've got this all wrong, but how can i transfer sessions from point A to B with Uploadify? Looks like there is no problems doing this with basic AJAX calls (jQuery) but if i use Uploadify it wont work.

By : Henrikz


Answers

The scriptData: attribute is your friend. Use it to pass any variables to your receiving for you might need, as your session data will not persist.



Uploadify doesn't preserve the browser cookies because it uses flash to upload the file. The easiest solution is to pass the session id in POST, then use it to lookup the session.

Example from first link:

$_COOKIE['PHPSESSID'] = $_POST['PHPSESSID'];
session_start();

Relevant threads:

Sessions and uploadify
Uploadify not passing variables, Session problem??
jquery uploadify and codeigniter session id problem
http://www.uploadify.com/forums/discussion/43



This video can help you solving your question :)
By: admin