Link to home
Start Free TrialLog in
Avatar of tr5
tr5

asked on

Working with sessions and input type=file in a multi-page form

Hi

I need to make a multi-page form. One of the pages will have "input type=file" elements.
1. Is it possible to save these values in session variables for posting? Will the actual file upload somehow be done when I finally submit the whole form?
2. Regarding posting generally: How do I post session variables at the end of the process of the user filling in all the pages? Do I make a dummy form with hidden variables for all the variables previously saved as session variables?

Thank you
tr5
ASKER CERTIFIED SOLUTION
Avatar of soapergem
soapergem
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
regarding question number 2, why would u need to post session variables anyway?????? u use $_POST to get data from the user, and usually u add it to db, mail it, or do whatever u want with it, now, u already have the data you want, why do u want to have it as POST ?????
instead of having this query "select name from table1 where lname=$_POST['lname'], u can use select name from table1 where lname=$_SESSION['lname'] !!

got me ?? i mean u already got the data, and if u must have in $_POST[] form, then make $_POST['lname'] = $_SESSION['lname']      (POST is an array after all)

for question 1..... it is so tricky !!!
Avatar of tr5
tr5

ASKER

Thanks for the explanation.
Oh whoops, I hope you noticed my silly error. When I listed out the four different properties of $_FILES, the list should have looked like this:

$_FILES['uploadFile']['tmp_name']
$_FILES['uploadFile']['name']
$_FILES['uploadFile']['size']
$_FILES['uploadFile']['error']

(Since we named it "uploadFile" in the HTML portion.) But I think that should have become clear with the rest of my comment.

And as for you, dr_dedo, what on Earth do you mean when you ask, "why would u need to post session variables anyway??????" (You didn't need to use six question-marks; one will suffice.) There are myriad reasons anyone would want to do this! It is true that you usually do things with the $_POST variables like add them to databases, mail them, etc., but storing them across sessions is also a perfectly logical thing to do in a number of cases.