note 60011 rejected from features.file-upload by nlopess
| From: | nlopess@php.net | Date: | Thu, 22 Dec 2005 20:41:22 +0000 |
| Subject: | note 60011 rejected from features.file-upload by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-100593@lists.php.net to get a copy of this message | ||
Note Submitter: ryan at allegorymarketing dot com
----
Hi,
I'm fairly new to PHP and have run into something very tough for me.
I'm trying to upload files, and put them into a directory based on a selection from a dropdown
menu.
The idea:
1) dropdown menu fills in from an array.
2) user selects a value.
3) the selected value becomes the directory name where the files will be uploaded into.
below is the code that fills in the dropdown menu, then the upload script. I can't figure out
step 3 though.
------ dropdown menu ------
<?php
if(is_array($user_list)) {
echo "<select name=\"user_selected\">\n";
foreach ($user_list as $user) {
echo "<option value=\"$user\">$user</option>\n";
}
echo "</select>\n";
}
else
echo $GLOBALS[no_users];
?>
------ upload script ------
<?php
$uploaddir = *** WHAT IS THIS VARIABLE??? ***;
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
{
echo 'upload succesfull';}
else {
echo 'Uploading Error';
}
?>