How can I validate telerik radupload for mimeTypes -> mean Prevent Change Extension by users!
in both Client and Server sides!
my radupload is like this :
<telerik:RadUpload ID="RadUpload" runat="server" EnableEmbeddedSkins="False" Skin="BlackByMe" AllowedFileExtensions=".txt" AllowedMimeTypes="text/plain"
ControlObjectsVisibility="ClearButtons" Width="325px">
</telerik:RadUpload>
as you can see the AllowedFileExtensions
is txt.
But, how can I prevent someone from changing a zip file's extension to txt and upload it.
There are many methods out there for Telerik RadUpload Validation Such As FileExtension-FileSize-Empty RadUpload, but what about validating the real MiMeType?
thanks in advance
Property AllowedMimeTypes
should work.
The AllowedMimeTypes property lists the valid MIME types for uploaded files. When the AllowedMimeTypes property is set, RadUpload automatically validates the MIME types of selected files, moving any files with disallowed extensions to the InvalidFiles collection.
Check this note
RadUpload does not determine the mime-type using only the file extension. For example if you try to upload a text file that has the extension ".JPG", it is still uploaded with text/plain mime-type.
<telerik:radupload id="RadUpload1" runat="server"
allowedmimetypes="application/x-compressed,application/x-zip-compressed,application/zip,multipart/x-zip"
maxfilesize="1000000" allowedfileextensions=".zip"
targetfolder="~/My Files" />