& $number = ?
Posts by gamesongz
-
-
Bedankt, dit is wat ik er van heb kunnen maken.
[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
$newfilename = 'song' . ($fileCount + 50) . '.mp3'; //New File Nameif(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']), '\\/').'/'.$uploadpath.'">';
}
else echo '<b>Unable to upload the file.</b>';
}
else echo $err;
}
?> [/code]Het probleem? Hij renamed naar Song**.mp3
Het probleem is, dat ie steeds dezelfde cijfer pakt.
Dus niet van 1 naar 2 etc gaat. -
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
Toon Meer<?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; } ?>
-
Hallo,
Ik zoek dus een klein php script.
Deze zou Files, met de .MP3 ext. moeten uploaden.
Maar.
Dat de Files, automatish worden ge-renamed, naar song1.mp3
Maar bij elke upload, moet die song1.mp3, met een getal omhoog gaan.
dus zoals dit:song1.mp3
song2.mp3
etc...Ik zou dit waarderen.
Alvast bedankt.
ik heb ook al op google zitten rondkijken.
Maar niks gevonden wat ik exact zoek.