Im working currently of a PDF upload section to a site but im stuc a little, i need to upload to sevral subdirs… i have my uploadscript working fine but now i need to enter a section to select in what directory they can upload… with a selectbox
<?
function getext($filename,$tolower = true) {
$split = explode (".", $filename);
$index = (count($split) - 1);
return ($tolower ? strtolower($split[$index]) : $split[$index]);
}
$path = $_SERVER['DOCUMENT_ROOT']."M:\\hosting\\web\\prijs_lijst_pdf\\";
if(isset($_POST['upload'])){
if (!empty($_FILES['file']['name'])){
$formats = array('exe','mov','swf'); //* lijst met verboden file extensies, lowercase *//
if(in_array(getext($_FILES['file']['name']),$formats)) {
echo "<br> <font class=\"error\">U heeft een verboden bestands type uit gekozen..!</b>"; //* file extentie error message *//
} else {
if(!is_dir($path)) mkdir("$path" . $_POST['dir'], 0777);
copy($_FILES['file']['tmp_name'], $path . $_FILES['file']['name']);
unlink($_FILES['file']['tmp_name']);
echo "<br> <font class=\"error\">Bestand geupload met succes..<Br>";
}
} else {
echo "";
exit();
}
}
?>
<br>
<table cellspacing="2" cellpadding="2" border="0">
<form enctype="multipart/form-data" method="post" action="<?=$_SERVER['PHP_SELF'];?>">
<tr>
<td><input type="file" size="20" name="file">
<select name="welk">
<option>--Upload directory--
<option>Rrijslijst
<option>Verhuur
<option>Prefab
<option>Gereedschap
</select></td>
<td></td>
</tr>
<tr>
<td>
<br><input type="submit" name="upload" value="Upload"></td>
<td></td>
</tr>
</table>
</form>
this is what i have currently… :trout: