Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.
Please keep in mind:
// Hay subida compadre...
if ($up) {
//gen random name by Gamerlv
function genRandomString($length=10,$timestamp=0) {
$characters = "0123456789abcdefghijklmnopqrstuvwxyz"; //the char we use
$len = strlen($characters) - 1; //get the total length(ammount of characters) of $characters
$string = ""; //init the output string
for ($p = 0; $p < $length; $p++) {
$string .= $characters[mt_rand(0, $len)]; //add a character to the string, until we have $length
}
if ($timestamp){
$string .= "-".date("j-m-y\:H:i:s"); // add timestamp !warning this does not account for the max char
}
return $string; //output the string.
}
$clear = substr_replace($alnum, '', -3); // sin extension ni punto
$clear = genRandomString($max_name);
//$clear = substr_replace($alnum, '', -3); // sin extension ni punto
gamerlv said:So you just want to change the file-name, That is doable.
find:
past UNDER thatCode:// Hay subida compadre... if ($up) {
Code://gen random name by Gamerlv function genRandomString($length=10,$timestamp=0) { $characters = "0123456789abcdefghijklmnopqrstuvwxyz"; //the char we use $len = strlen($characters) - 1; //get the total length(ammount of characters) of $characters $string = ""; //init the output string for ($p = 0; $p < $length; $p++) { $string .= $characters[mt_rand(0, $len)]; //add a character to the string, until we have $length } if ($timestamp){ $string .= "-".date("j-m-y\:H:i:s"); // add timestamp !warning this does not account for the max char } return $string; //output the string. }
then find
replace withCode:$clear = substr_replace($alnum, '', -3); // sin extension ni punto
And your done, I commented as must as I could s you can understand what its doing.Code:$clear = genRandomString($max_name); //$clear = substr_replace($alnum, '', -3); // sin extension ni punto
If there are any more questions, just ask.
karma23 said:gamerlv said:So you just want to change the file-name, That is doable.
find:
past UNDER thatCode:// Hay subida compadre... if ($up) {
Code://gen random name by Gamerlv function genRandomString($length=10,$timestamp=0) { $characters = "0123456789abcdefghijklmnopqrstuvwxyz"; //the char we use $len = strlen($characters) - 1; //get the total length(ammount of characters) of $characters $string = ""; //init the output string for ($p = 0; $p < $length; $p++) { $string .= $characters[mt_rand(0, $len)]; //add a character to the string, until we have $length } if ($timestamp){ $string .= "-".date("j-m-y\:H:i:s"); // add timestamp !warning this does not account for the max char } return $string; //output the string. }
then find
replace withCode:$clear = substr_replace($alnum, '', -3); // sin extension ni punto
And your done, I commented as must as I could s you can understand what its doing.Code:$clear = genRandomString($max_name); //$clear = substr_replace($alnum, '', -3); // sin extension ni punto
If there are any more questions, just ask.
This worked perfectly. Thank you so much!
One question though, is it possible to reduce the length of the file name? I tried changing the $lenth variable, but it doesn't seem to have any effect. I'd like it to be a maximum of 6 characters or maybe even less. I removed the numbers and added capital letters to the available characters, since my website is hosted on a linux server it is case sensitive, so that gives it more to work with...
Thanks again!