Advanced search  


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.

Pages: [1]   Go Down

Author Topic: [solved] how to autochange uploaded filenames ?  (Read 2883 times)

0 Members and 1 Guest are viewing this topic.


  • Translator
  • Coppermine newbie
  • **
  • Offline Offline
  • Posts: 13
[solved] how to autochange uploaded filenames ?
« on: March 09, 2006, 10:09:35 pm »

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:

Code: [Select]
                    // 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:

Code: [Select]
$matches[1] = time();

and that's all :)
« Last Edit: March 10, 2006, 08:59:20 am by GauGau »
Pages: [1]   Go Up

Page created in 0.018 seconds with 19 queries.