Advanced search  

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

Pages: [1]   Go Down

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

0 Members and 1 Guest are viewing this topic.

liorda

  • 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 »
Logged
Pages: [1]   Go Up
 

Page created in 0.016 seconds with 19 queries.