I want to validate the file name of the files to be uploaded from the Media Library.
CASE study: I want to restrict the file name containing ‘%’, ‘. .’, ‘/’ etc..from uploading to the media library.
I can restrict the file types but not able to restrict as per the file names.
Suggest me any wordpress filter or any procedure to accomplish the solution.
The filter is
sanitize_file_name
. You get the$filename
as parameter.Sample code:
See my plugin Germanix URL for an extended example.