I asked this question before but I was not very specific. I am working on a 2 page form. I need to have a file upload on the first page. I need to pass the file upload values to the insert page. I am not sure what approach to take. I have tried sessions but had no luck.
Here is a simplified version of my code.
Page 1:
Page 2:
Page 3:
<?php $uploadDir = 'upload/'; if(isset($_POST['upload'])) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $filePath = $uploadDir . $fileName; $result = move_uploaded_file($tmpName, $filePath); if (!$result) { echo "Error uploading file"; exit; } include 'includes/config.php'; include 'includes/opendb.php'; if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); $filePath = addslashes($filePath); } $query = "INSERT INTO contacts (first, name, size, type, path ) ". "VALUES ('$first', '$fileName', '$fileSize', '$fileType', '$filePath')"; mysql_query($query) or die('Error, query failed : ' . mysql_error()); include 'includes/closedb.php'; echo "Files uploaded
"; } ?>
Need to get the upload values from Page1 - Page3
Thank you in advance,
Scott