Add timestamp to uploaded files
-
Hi, i want to add a timestamp to filenames of every uploaded file.
I found this code, but it doesn’t work:function sanitize_file_uploads( $file ){ $file['name'] = sanitize_file_name($file['name']); $file['name'] = preg_replace("/[^a-zA-Z0-9\_\-\.]/", "", $file['name']); $file['name'] = date('d-m-Y')."_".$file['name']; $file['name'] = strtolower($file['name']); add_filter('sanitize_file_name', 'remove_accents'); return $file; } add_filter('wp_handle_upload_prefilter', 'sanitize_file_uploads');
Can anyone help me, please?
Best regards.Roberto
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Add timestamp to uploaded files’ is closed to new replies.