Using Sessions with Uploadify

In Uploadify, the Flash file is what communicates with the backend script.  Because of a bug in Flash, the session cookie is not picked up by the Flash file.  To circumvent this, you will need to pass the session data via the formData option.  To do this in PHP, use the following code when initializing Uploadify on the front-end page:

This will send the session ID as the value of a post (or get, depending on the method you’ve set)  parameter to the server-side upload script (uploadify.php) with a key of whatever your session_name is.

At the beginning of your uploadify.php script, you can use the following code to load the proper session:

 This will start the proper session and allow you to use any session variables as expected.

For an extra layer of security, you can call session_regenerate_id() in some PHP code that is fired when your uploads are done.