This solution was published by the user 'lethal.industry' here . You must paste this code inside the UploadHandler class in the UploadHandler.php file
//custom function which generates a unique filename based on current time protected function generate_unique_filename($filename = "") { $extension = ""; if ( $filename != "" ) { $extension = pathinfo($filename , PATHINFO_EXTENSION); if ( $extension != "" ) { $extension = "." . $extension; } } return md5(date('Ymd H:i:s:u')) . $extension; }
You can change the file name as you like, change the last line of "return ..."
Then you search for the handle_file_upload function in UploadHandler.php and replace this line
$file->name = $this->get_file_name($uploaded_file, $name, $size, $type, $error, $index, $content_range);
for this line
$file->name = $this->generate_unique_filename($name);
source share