2

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.

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

Ah, Thanks! But, how would the JS be? just as it is, or do i need to add something to the JS file? or is there any good examples i can look at to get this right? Cheers!
@Henrikz, np, add this to your Uploadify params (taken from last link)... 'scriptData': {'PHPSESSID': '<?php echo session_id();?>'},
Hm, sounds like an easy task to edit the ID and "hack" the upload? or i'm i wrong?
0

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.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.