Link to home
Start Free TrialLog in
Avatar of pillmill
pillmill

asked on

popup to upload file and set session values?

I would like to use a popup to upload a file and then to also
set $_SESSION values. These values should be saved after the
popup closes so that they can be used to fill fields in the main page.
The  popup, below, is not saving the $_SESSION values.
How can this be fixed?

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

 <?php
 if(!empty($_FILES) ){
$_SESSION['name']=$_FILES['in_file']['name'];  
echo  $_SESSION['name']; //for testing
}
?>  
   
</head>

<body>

<script language="javascript" type="text/javascript">

function popitup(url) {
      newwindow=window.open(url,'name','height=200,width=150');
      if (window.focus) {newwindow.focus()}
      return false;
}

</script>

<input type="file" name="in_file" id="in_file">
<input type="submit" name="submit">

</body>
</html>
Avatar of Chris Harte
Chris Harte
Flag of United Kingdom of Great Britain and Northern Ireland image

Even though it is a popup, it is still a separate page. You need to include the function session_start() as the first line of php in every page.

http://uk3.php.net/manual/en/function.session-start.php
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial