note 60011 added to features.file-upload
| From: | ryan at allegorymarketing dot com | Date: | Thu, 22 Dec 2005 20:28:01 +0000 |
| Subject: | note 60011 added to features.file-upload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-100592@lists.php.net to get a copy of this message | ||
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';
}
?>
----
Manual Page -- http://www.php.net/manual/en/features.file-upload.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60011
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60011&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60011&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60011&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60011&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60011&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60011&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60011&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60011&report=yes
Search -- http://master.php.net/manage/user-notes.php