all browsers supported by
Retrieving the name of the uploaded file(s)
and directory for restricting file upload/rename or directory
creation/rename checking the name by Regular Expression
There is not a built
in function in Rad File Explorer (that is the component inside Rad
Editor dialogs) to inhibit uploading/renaming file name or
creating/renaming directory with strange chars like "$" or "%" and so
on. It happens that in a CMS solution built with RadControls the user
loads file with these chars and even if windows server accepts them the
file system could be "dirty" and full of strange file. The same thing
happens with the creation of directory or renaming of files.
this solution I created a new class derived
from Telerik.Web.UI.Widgets.FileSystemContentProvider that though a
simple regular expression check what the user loads or renames and in
case the names are not compatible with the rules of the website answer
change automatically changes the name and upload or advises the user with
an alert and of course cancel the operation itself.
commented all the code and I created a region called "customization"
where the developer can change the behavior of the message of the class.
The regular expression that corresponds to the website rules
>>>> The char that substitutes the invalid chars
find by the regex
>>>> Works only on the upload file, represents if the
developer wants to check about an existing file
= Enum, the developer can check if he want to advise the user
with an alert or change the name directly
= Message for the alert about rename file
Message for the alert about upload file
= Message for the alert about already existing file, it happens
when the file uploaded is not the same into the directory (the
component block it) but with changing by the code could be in the dir.
= Message for the alert about rename directory
Message for the alert about create directory
is also a function called "ReturnCorrectString" that the developer have
to change for implementing its own changing logic for require the website's