tags:

views:

57

answers:

1

Hi ,

Not sure if that was the best Title in the world but I hope this part gives you a clearer understanding of what my question is.

Basically I need to send a File using a Form to the folder "uploads" from page 1

I then go to page 2

I then need to then send the same file to the database from page 2

Is there a way on page 2 to define the Value as say Value="upload/"

?

I tried this way but it did not work.

How can I make the value a file which is in a folder in my server

Or is there another way to do is like past the file in a POST to the next page ?

+1  A: 

Put the name of the file in a $_SESSION variable, say $_SESSION['curfile']='myfile.ext'; When processing the 2nd page, get the file name from the $_SESSION and store it in the database.

dnagirl
Perfect :) Thanks a alotSo would the session store the file?then all I do is make the variable the filename ? Then echo out the variable into the value ?
Oliver Bayes-Shelton
No, the file is stored in whatever directory you told it to be stored in. When you want to put in the db, you use the filename (with the directory you know you put it in) to copy it from where it is to the db. But really, it's better to just store the path to the file in the db and let the file live in a filesystem.
dnagirl
Sorry to be a pain but say if I stored it in uploads and the filename was called test01 how could I then place that file automatically into a form and upload it again ?
Oliver Bayes-Shelton
So when you process page1, you store the uploaded file as /uploads/test01. You put the string 'test01' in your $_SESSION. When you want to move the file somewhere else, you would either copy or move `"/uploads/{$_SESSION['filename']}"` to the desired directory. You do NOT need to "upload" the file twice because it is already on the server.
dnagirl