Dus, ik wil eigenlijk dit...
Dat ie de filename, Auto renamed naar song**.mp3
Die ''**'' Moeten in cijfers veranderen.
Dus bevoorbeeld,
ik upload hoi.mp3 op.
Die wordt gerenamed naar song1.mp3
Iemand anders load qskdklq.mp3 op.
Dan wordt die gerenamed naar song2.mp3
Ik zou het waarderen, als iemand mij hierbij zou helpen.
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
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'], $uploadpath)) {
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']), '\\/').'/'.$uploadpath.'">';
}
else echo '<b>Unable to upload the file.</b>';
}
else echo $err;
}
?>
Toon Meer