Javascript-failed to set session?

Source: Internet
Author: User
I used an image Upload plug-in: uploadify. due to a 302 error in uploading files under IE and Firefox, I uploaded the current session name session_name () to the background at the front end and re-established the session, but I have done the following: the backend can receive the parameter passed by session_name (), but when the session is re-established, it will... using an image Upload plug-in: UploadifyBecause the error 302 is uploaded under IE and Firefox, I uploaded the current session name on the front end. session_name()To the background, re-establish the session, but I have done the following, the background can receive session_name()But when the session is re-established, it will fail. how can this problem be solved?

Front-end:

// This is the parameter 'formdata': {'timestamp': 'that the uploadify plug-in transfers data to the backend ':'
  ', 'Token ':'
  ','
  ':'
  ', // The above session parameter is rendered like this: 'phpsessid ':'',},

Backend:

// This is the initialization method of a public controller to verify the login function _ construct () {parent ::__ construct (); $ session_name = session_name (); $ post_session_name = $ this-> input-> post ($ session_name); if (isset ($ post_session_name) {// you can enter session_id ($ post_session_name) here after testing ); // However, in this case, you want to set session failure session_start ();} if (! $ This-> session-> valid_user () {// because the session fails to be set, the frontend returns 302 redirect (module_url ('Common/login '));}}

Reply content:

Using an image Upload plug-in:UploadifyBecause the error 302 is uploaded under IE and Firefox, I uploaded the current session name on the front end.session_name()To the background, re-establish the session, but I have done the following, the background can receivesession_name()But when the session is re-established, it will fail. how can this problem be solved?

Front-end:

// This is the parameter 'formdata': {'timestamp': 'that the uploadify plug-in transfers data to the backend ':'
  ', 'Token ':'
  ','
  ':'
  ', // The above session parameter is rendered like this: 'phpsessid ':'',},

Backend:

// This is the initialization method of a public controller to verify the login function _ construct () {parent ::__ construct (); $ session_name = session_name (); $ post_session_name = $ this-> input-> post ($ session_name); if (isset ($ post_session_name) {// you can enter session_id ($ post_session_name) here after testing ); // However, in this case, you want to set session failure session_start ();} if (! $ This-> session-> valid_user () {// because the session fails to be set, the frontend returns 302 redirect (module_url ('Common/login '));}}

Check whether there is any error message in the log?session_idIt must be set before the session starts. is the session enabled somewhere else before the controller's _ construct () call? Try adding one before session_id.session_abort()What about it?

By default, you can use the cookie to save session_id to check whether the cookie is disabled or cleared.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.