jQuery and Uploadify session in the php file

寵の児 提交于 2019-12-24 03:24:46

问题


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.


回答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




回答2:


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.



来源:https://stackoverflow.com/questions/5158603/jquery-and-uploadify-session-in-the-php-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!