I can't figure this out. I have a form that is submitting two fields.
//submit page//
<form enctype="multipart/form-data" action="test2.php" method=post>
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
<br>
<input name="userfile" type="file">
Choose Folder to Upload to:<br>
<select name="directory">
<option value="value1">value1
<option value="value2">value2
<option value="value3">value3
<option value="value4">value4
Upload this file:
<input type="submit" value="Send File">
</form>
On the php page I have it processing the file in the following way.
The idea is that the person can choose a directory where they wish to upload the files. I can echo the values from the submit page and they show up, however, it will not process the $directory value in any way.
In other words the "if ($directory == " errors out. But if I take out the "exit;" portion the file will get uploaded to the location the script is in.
<?
if ($directory == "value1")
{
$upfile = "/path/to/upload/directory/";
} else
{
echo "ERROR!";
exit;
}
$filepath = $upfile."".$userfile_name;
if ($userfile<>"none") {
if(!copy($userfile, $filepath)) {
print "File failed to upload";
}
else {
print "File uploaded";
}
}
?>
Thanks!