I have client who is uploading files with lots of naming issues; Spaces, dots, parenthesis, and other characters in the filenames.
Is it possible to strip out the special characters, automatically, upon upload?
Thank you in advance.
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It only takes a minute to sign up.Sign up to join this community
Your best bet would be to make an extension that hits this hook:
And renames the file after upload. I would check the File helper to see if it can rename files:
If not you'll have to do it in pure PHP:
Be warned; after rename the file, you'll need to use the database class to update all Assets rows that have the file name of your original file, and update them with the new file name. Also probably the EE files table.
Actually, at this point, you could honestly just hack the Assets core. I highly do not recommend doing that, but it would work for now. just regex out anything that isn't alpah-numeric.