Hi,
I have a simple script to upload files which works fine, but i wanted to add a drop down with categories and based on that, the file gets uploaded to that folder.
Here's what i have for the form:
form action="uploader.php" method="POST" enctype="multipart/form-data" name="form1" id="form1">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" />
Select a folder:
<select name="select" id="select">
<option value="802.11">802.11</option>
<option value="RIM">RIM</option>
</select>
<br />
<input type="submit" value="Upload File" />
</form>
And i have this as the uploader.php script:
<?php
$FOLDER = $_GET['select'];
// Where the file is going to be placed
$target_path = "/var//* Add the original filename to our target path. Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
// This is how we will get the temporary file...
$_FILES['uploadedfile']['tmp_name'];
$target_path = "/var/
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
This doesn't seem to work, i guess im not passing the drop down selection data into the variable on the uploader.php file OR im not calling the right _GET variable to get that data
Any help is apprecaited
Thanks
dR
I have a simple script to upload files which works fine, but i wanted to add a drop down with categories and based on that, the file gets uploaded to that folder.
Here's what i have for the form:
form action="uploader.php" method="POST" enctype="multipart/form-data" name="form1" id="form1">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" />
Select a folder:
<select name="select" id="select">
<option value="802.11">802.11</option>
<option value="RIM">RIM</option>
</select>
<br />
<input type="submit" value="Upload File" />
</form>
And i have this as the uploader.php script:
<?php
$FOLDER = $_GET['select'];
// Where the file is going to be placed
$target_path = "/var//* Add the original filename to our target path. Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
// This is how we will get the temporary file...
$_FILES['uploadedfile']['tmp_name'];
$target_path = "/var/
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
This doesn't seem to work, i guess im not passing the drop down selection data into the variable on the uploader.php file OR im not calling the right _GET variable to get that data
Any help is apprecaited
Thanks
dR