I'm trying to figure out, how to direct uploads to a specific sub-folder
based on the name of a pull-down choice in the form.
I have all the sub-folders created inside my "files" folder.
For instance if the choice in their pulldown was "cars"
the file they upload would go into the sub-folder /files/cars
The choices are from "field_3"
Here is the code from my processor.php file:
// File upload handling
if($_FILES!=''){
$field_7_filename=$_FILES;
if(!move_uploaded_file($_FILES, "./files/".$field_7_filename)){
die("File " . $_FILES . " was not uploaded.");
}
}
I'm trying to figure out, how to direct uploads to a specific sub-folder
based on the name of a pull-down choice in the form.
I have all the sub-folders created inside my "files" folder.
For instance if the choice in their pulldown was "cars"
the file they upload would go into the sub-folder /files/cars
The choices are from "field_3"
Here is the code from my processor.php file:
// File upload handling
if($_FILES!=''){
$field_7_filename=$_FILES;
if(!move_uploaded_file($_FILES, "./files/".$field_7_filename)){
die("File " . $_FILES . " was not uploaded.");
}
}
$fileLine = "First Name : " . $_POST . "
Last Name: " . $_POST . "
Contest Name : " . $_POST . "
State: " . $_POST . "
E-mail: " . $_POST . "
Confirm E-mail: " . $_POST . "
Upload File: ".$where_form_is."files/".$field_7_filename."
";
$filename = 'data.csv';
if (is_writable($filename)) {
if (!$handle = fopen($filename, 'a'))
{
echo "Cannot open file ($filename)";
exit;
}
if (fwrite($handle, $fileLine) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
fclose($handle);
} else {
echo "The file is not writable";
}
include("confirm.html");
?>