forum.coppermine-gallery.net
Support => cpg1.4.x Support => Older/other versions => cpg1.4 upload => Topic started by: liorda 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:
// 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 :)