How can you change the error message when a user uploaded an invalid file type?

Feb 20, 2014 at 2:59 AM
How can you change the error message when a user uploaded an invalid file type?

The current message is not very friendly. I am getting this message:

the File sample.exe Is A Restricted File Type. Valid File Types Include ( swf, .jpg, .jpeg, .jpe, .gif, .bmp, .png, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf, .txt, .xml, .xsl, .xsd, .css, .zip, .rar, .template, .htmtemplate, .ico, .avi, .mpg, .mpeg, .mp3, .wmv, .mov, .wav, .mp4, .csv ). Please Contact Your Hosting Provider If You Need To Upload A File Type Which Is Not Supported.

Is it possible to change it and style it as well?
Coordinator
Feb 20, 2014 at 8:53 AM
Edited Feb 20, 2014 at 8:59 AM
You can change the error message using the Language Editor under Admin :: Languages.

Before you start: there are three columns under "Static Resources" - you should not use the first one (System), as this might be overwritten by the next DNN update. If you use "Host", you change this message for all portals on your DNN installation, if you use "Site", only the current portal is affected. (I think you won't see the "System" and "Host" columns if you are not logged in as a host user but a "simple" portal administrator).

As this is a DNN resource you should be aware that this message is not used by helferlein_Form only, but all modules that use it - propably most of the modules that offer file uploading capabilities.

And: You have to do this for any language of your portal if you have a multi-lingual site.

Click the image with the pencil in the appropriate column. On the left side, expand "Global Resources", then select "SharedResources". Find the key "FileRestricted.Text" and edit the text - you must include the format items "{0}" and "{1}", otherwise you will run into an error! {0} is a placeholder for the file name, {1} is a placeholder for the allowed extensions. For more information see here: String.Format

Styling this element should be possible by either writing a theme for the form or including HTML syntax in the text field of the language editor - you have to try...

Best wishes
Michael