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

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

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 :)