[solved] how to autochange uploaded filenames ? [solved] how to autochange uploaded filenames ?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

[solved] how to autochange uploaded filenames ?

Started by liorda, March 09, 2006, 10:09:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

liorda

When people sending me images via coppermine, the files are upladed properly, but i want to change the filename of the uploaded photos automaticlly.

I'm using hebrew filesystem, but I want the pictures filenames to be in english (so that non-hebrew browsers can access them).

How can i do it?


EDIT: Solved.

If you got here by google (keywords: hebrew עברית filenames upload coppermine change), here is the answer:

open file upload.php and search for:

                    // Initialise the $matches array.
                    $matches = array();

                    // If magic quotes is on, remove the slashes it added to the file name.
                    if (get_magic_quotes_gpc()) $_FILES['file_upload_array']['name'][$counter] = stripslashes($_FILES['file_upload_array']['name'][$counter]);

                    // Create the holder $picture_name by translating the file name. Translate any forbidden character into an underscore.
                    $picture_name = replace_forbidden($_FILES['file_upload_array']['name'][$counter]);

                    // Analyze the file extension using regular expressions.
                    if (!preg_match("/(.+)\.(.*?)\Z/", $picture_name, $matches)) {

                        // The file name is invalid.
                        $matches[1] = 'invalid_fname';

                        // Make a bogus file extension to trigger Coppermine's defenses.
                        $matches[2] = 'xxx';
                    }


add after it:

$matches[1] = time();


and that's all :)