I have the following form that allows uploading a file:
<form id="form1" name="form1" method="post" action="page1.php" enctype="multipart/form-data">>
CSV list: <input type="file" name="file" id="file">
<input type="submit">
</form>
When I go to my action/submit page I can retrieve the file and the temp location of the file, but I need to send it through again to a new page, so I do the following:
<form method="post" action="page2.php" name="details" >
<input type="hidden" id="type" name="type" value="1">
<input type="hidden" id="filename" name="filename" value="<? echo $_FILES["file"]["tmp_name"]; ?>">
<input type="submit" value="Insert Into Database">
</form>
This doesn't work because the temp file is already gone.... how can I pass the file through?
I think you want to rethink how you are getting this data. If it was me, I would want to have the first form upload the file to a temporary directory and pass the path to the file through a $_REQUEST. Then use a hidden input field pass the file path name through PHP and if they confirm their selection on the second form, do whatever you want with the file using the file's path. This means you don't have to upload two files(not efficient) and you can pass the data onto the second form.