简体   繁体   中英

How to validate Telerik RadUpload - MiMeTypes - Prevent Change Extension

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

<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" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM