I found an issue with my upload file form.
A user might upload a file named in Greek language (I know that he/she shouldn’t) in that case the file will be uploaded but the name will change to something unreadable like:
“20140520082344_ΞΞΞΞΞΞΉΞΊΞ_ΞΟΟΞµΞΞ_ΞΞµ_ΞΊΞµΞΞ_1.jpg” it might look like Greek to you but trust me it isn’t 🙂
How can I change the files name after the time stamp.
example "20140520082344_uploadedfile.jpg"
File: /administrator/components/com_chronoforms5/chronoforms/actions/file_upload/file_upload.php
A user might upload a file named in Greek language (I know that he/she shouldn’t) in that case the file will be uploaded but the name will change to something unreadable like:
“20140520082344_ΞΞΞΞΞΞΉΞΊΞ_ΞΟΟΞµΞΞ_ΞΞµ_ΞΊΞµΞΞ_1.jpg” it might look like Greek to you but trust me it isn’t 🙂
How can I change the files name after the time stamp.
example "20140520082344_uploadedfile.jpg"
File: /administrator/components/com_chronoforms5/chronoforms/actions/file_upload/file_upload.php
//mask the file name
if(strlen($this->config->get('forced_file_name', '')) > 0){
$file_name = str_replace('FILE_NAME', $file_name, $this->config->get('forced_file_name', ''));
}else{
$file_name = date('YmdHis').'_'.$file_name;
}
}
Can't say if this is the best solution but it will change any filename to something like this: 20140521092017_file.jpg
Edit File: administrator/components/com_chronoforms5/chronoforms/actions/file_upload/file_upload.php
Edit File: administrator/components/com_chronoforms5/chronoforms/actions/file_upload/file_upload.php
//mask the file name
if(strlen($this->config->get('forced_file_name', '')) > 0){
$file_name = str_replace('FILE_NAME', $file_name, $this->config->get('forced_file_name', ''));
}else{
$parts = explode('.',$file_name);
$filesuffix = $parts[1];
$file_name = 'file.'.$filesuffix;
$file_name = date('YmdHis').'_'.$file_name;
}
This topic is locked and no more replies can be posted.