Page 1 of 1

File upload and Session variables problem

Posted: Mon May 29, 2006 2:03 am
by mganesh
twigletmac | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Here is a peculiar problem that I am encountering 

This problem is ONLY IN FIREFOX and NOT IN IE (Important !)

I have two pages page1.php, page2.php 

Here are the exerpts from the two files.

[b]page1.php :[/b]

Code: Select all

session_start();
session_register("username_session");
session_register("fullname_session");
$_SESSION["username_session"]=<value from database>
$_SESSION["fullname_session"]=<value from database>
There is also a form for uploading 5 files (MAX_FILE_SIZE is mentioned as a hidden field with 1000000 as the value)

page2.php :

Code: Select all

session_start();
echo $_SESSION["username_session"]."<BR>";
echo $_SESSION["fullname_session"];
echo $_SESSION["session_variable_created_in_earlier_page"];
The file info posted from the previous page is available here, and also the session variable created on another previous page, but not the session variables created and assigned in page1.php.

The observation: Session variables created on the same page where a file upload form resides, vanish in the next page. This is observed only in firefox and not internet explorer. In IE everything is just fine.

Has any one come across this problem ?


twigletmac | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Mon May 29, 2006 4:35 am
by twigletmac
First off - stop using session_register() it is uneccessary and can cause problems in combination with $_SESSION. Then check your cookie settings in Firefox - if a session cookie can't be set then the session won't work.

Mac