Multiple FOLDER file upload troubles

Hello everyone,
I’m working on a script to run on my web site that allows users to upload files from an HTML form with a drop down menu that lists different folders they can upload to. So far it works where they can upload to the main uploads/ folder, but not into any subfolders. Here’s my HTML form code so far.

[code]
File to Upload:




 




Folder 1 Folder 2 [/code] And here's the PHP code... [code]<?php $uploaddir = 'uploads/'; $uploadfile = $uploaddir . basename($_FILES['file']['name']); if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) { echo "

File Uploaded



Upload More Files | View Uploaded Files "; } else { echo "

Sorry! There was an error uploading your file.



Go Back "; } ?>[/code] I don't know what I should do so that the script looks at what folder was specified in the drop down menu and uploads the file to that folder. Any ideas?

I think it would just require you to fetch the ‘folder’ value?

$uploaddir = $_POST['folder'];

I changed the PHP script so that it looks for the value in the folder drop down menu. And created the folder 1 and folder 2. However, I’m not sure what to put in the Folder 1 The main uploads directory is /uploads, so for the value I put ‘/uploads/folder1’ when I do that, the script goes to the error line, same with ‘/uploads/folder1/’ When I set the value to ‘/folder1’ and create that folder not in the uploads folder, in the folder with all the pages and scripts, it says the file was uploaded, but when I look. It didn’t actually upload anywhere. I’m sure it will work, I’m just not sure what needs to go inside the option value to make it work.

Sponsor our Newsletter | Privacy Policy | Terms of Service