• Welcome to the Chevereto User Community!

    Here, users from all over the world come together to learn, share, and collaborate on everything related to Chevereto. It's a place to exchange ideas, ask questions, and help improve the software.

    Please keep in mind:

    • This community is user-driven. Always be polite and respectful to others.
    • Support development by purchasing a Chevereto license, which also gives you priority support.
    • Go further by joining the Community Subscription for even faster response times and to help sustain this space

rename existing file with original_name-timestamp

smed79

Chevereto Noob
Hello,
I just downloaded the script and try it 😛 i love this code 🙂
i suggest & i prefair renam upload file with : "original_name-timestamp"

Open "engine.php" and find :

Code:
            // Random
            $ch_1 = chr(rand(ord("a"), ord("z")));
            $ch_2 = chr(rand(ord("z"), ord("a")));
            
            if ($conteo>$max_name) {
                $renombre = substr("$clear", 0, $max_name);
            } else {
                if (empty($clear)) {
                    $renombre = $ch_1.$ch_2.$ch_1;
                } else {
                    $renombre = $clear;
                }
            }
                
            // Si existe el nombre, renombramos el que estamos subiendo.
            if (file_exists(DIR_IM.$renombre.'.'.$exten)) {
                if ($conteo>$totalchars) { 
                    // Si el nombre es muy largo, corta
                    $renombra = substr("$renombre", 0, $max_name-4); // 4 -> El remplazo de mas abajo            
                } else { 
                    $renombra = $renombre;    
                }
                // Vamos a darle caracteres aleatorios.            
                $name = $renombra.$ch_1.$ch_2.$ch_1.'.'.$exten;
            } else { 
                $name = $renombre.'.'.$exten;
            }

Replace with :
Code:
            // Random // If file exists add Timestamp // by smed79
            $tm = time();
    
            if ($conteo>$max_name) {
                $renombre = substr("$clear", 0, $max_name);
            } else {
                if (empty($clear)) {
                    $renombre = $tm;
                } else {
                    $renombre = $clear;
                }
            }
                
            // Si existe el nombre, renombramos el que estamos subiendo.
            if (file_exists(DIR_IM.$renombre.'.'.$exten)) {
                if ($conteo>$totalchars) { 
                    // Si el nombre es muy largo, corta
                    $renombra = substr("$renombre", 0, $max_name-4); // 4 -> El remplazo de mas abajo            
                } else { 
                    $renombra = $renombre;    
                }
                // Vamos a darle caracteres aleatorios.            
                $name = $renombra.-$tm.'.'.$exten;
            } else { 
                $name = $renombre.'.'.$exten;
            }


Thank you for all developer 😀.
 
Thank you, this has been really helpful. I edit it from time to time, to make it include specific words I want related to my image hosting site 😉
 
Back
Top