How can I restrict characters in the file name of files uploaded to the media section? I'd rather users not be allowed to upload files with spaces or other characters in the file name, or at least have Umbraco strip them out. I had a user upload a PDF with an ampersand in the name which causes a YSOD when someone tries to download the file.
Late reply to this thread, but we're having similar issues using Contour 3/Umbraco 6.1.5, where we allow commenters to upload attachments. When those attachments have ampersands in the filenames, it's hard for us to write any code that allows us to link directly to those files again. Short of some sort of workflow after the form is processed to both alter the SQL database entry plus change the stored filename, would love an easier way to deal with this problem.
Restrict characters for uploaded files
How can I restrict characters in the file name of files uploaded to the media section? I'd rather users not be allowed to upload files with spaces or other characters in the file name, or at least have Umbraco strip them out. I had a user upload a PDF with an ampersand in the name which causes a YSOD when someone tries to download the file.
Hi Connie,
You can use a event handler for that, like this : http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events/event-examples/adjust-media-file-so-it%27s-url-friendly
Late reply to this thread, but we're having similar issues using Contour 3/Umbraco 6.1.5, where we allow commenters to upload attachments. When those attachments have ampersands in the filenames, it's hard for us to write any code that allows us to link directly to those files again. Short of some sort of workflow after the form is processed to both alter the SQL database entry plus change the stored filename, would love an easier way to deal with this problem.
is working on a reply...