• Welcome to the Chevereto user community!

    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:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

rename existing file with original_name-timestamp

smed79

Chevereto Noob
Hello,
I just downloaded the script and try it :p 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 :D.
 
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