Hoe kan ik hiervan precies een multiple upload maken?
Forms heb ik al.
Ik zou graag dat ie 3 Files kan uploaden.
PHP
<?php
// Simple PHP Upload Script: http://coursesweb.net/php-mysql/
$uploadpath = ''; // directory to store the uploaded files
$max_size = 200000000; // maximum file size, in KiloBytes
$alwidth = 90000; // maximum allowed width, in pixels
$alheight = 80000; // maximum allowed height, in pixels
$allowtype = array('mp3'); // allowed extensions
$fileCount = (int) count(glob($uploadpath . "*.mp3"));
$newfilename = 'song' . ($fileCount + 1) . '.mp3'; //New File Name
if(isset($_FILES['fileup']) && strlen($_FILES['fileup']['name']) > 1) {
$uploadpath = $uploadpath . basename( $_FILES['fileup']['name']); // gets the file name
$sepext = explode('.', strtolower($_FILES['fileup']['name']));
$type = end($sepext); // gets extension
list($width, $height) = getimagesize($_FILES['fileup']['tmp_name']); // gets image width and height
$err = ''; // to store the errors
// Checks if the file has allowed type, size, width and height (for images)
if(!in_array($type, $allowtype)) $err .= 'Upload Failed, Invalid Extension';
if($_FILES['fileup']['size'] > $max_size*1000) $err .= '<br/>Maximum file size must be: '. $max_size. ' KB.';
if(isset($width) && isset($height) && ($width >= $alwidth || $height >= $alheight)) $err .= '<br/>The maximum Width x Height must be: '. $alwidth. ' x '. $alheight;
// If no errors, upload the image, else, output the errors
if($err == '') {
if(move_uploaded_file($_FILES["fileup"]["tmp_name"], "" . $newfilename)) {
echo 'Song successfully uploaded';
echo '<br />Link To Song <input type="text" class="optionstxt" readonly style="width:300px;" value="http://'.$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['REQUEST_URI']), '\\/').'/'.$newfilename.'">';
}
else echo '<b>Unable to upload the file.</b>';
}
else echo $err;
}
?>
Toon Meer