8 Answers, 1 is accepted
I have tested the scenario that you are describing and everything is working correctly on my end and the the file extensions are case insensitive.
Can you please elaborate which version of our controls you are using? If it is an old version, please upgrade to our latest versions and see if you will continue to face the same problem.
Regards,
Konstantin Dikov
Telerik
See What's Next in App Development. Register for TelerikNEXT.
Hi,
I am experiencing the same problem.
Here is how I have defined my RadAsyncUpload
<telerik:RadAsyncUpload ID="FileUpload" runat="server" OnFileUploaded="FileUpload_FileUploaded"
AllowedFileExtensions="pdf,png,gif,tif,dox,xlsx,xls,doc,docx" MultipleFileSelection="Automatic" PostbackTriggers="btnUpload"
Style="text-align: center;" />
<telerik:RadButton runat="server" ID="btnUpload" Text="Upload" />
But it's failing for all except PDF? Do I need to add something?
Please see attached output after Files have been selected.
Thanks in advance
Can you please try once again to upload the screenshot that you are referring to? Additionally, can you elaborate on the version that you are currently using, because with our latest versions there is no problem with the case sensitivity of the file extensions.
On a side note, you can also test our online demo, where you can upload files with case insensitive file extension:
I am looking forward to your reply.
Regards,
Konstantin Dikov
Telerik
Hello,
I am experiencing the same thing, however I cannot explain it. It is in the javascript client-side validation that it is happening.
So far, it is happening just for "JPG" vs "jpg". For instance both "txt" and "TXT" work and I only have "txt" in the allowed file extensions list. If the file's extension is "JPG" and I only have "jpg" in the allowed file extensions, the javascript function detects -1 and throws the "This file type is not supported." error.
Here is the js function that I am using:
function getErrorMessage(sender, args) {
var fileExtention = args.get_fileName().substring(args.get_fileName().lastIndexOf('.') + 1, args.get_fileName().length);
if (args.get_fileName().lastIndexOf('.') != -1) {//this checks if the extension is correct
if (sender.get_allowedFileExtensions().indexOf(fileExtention) == -1) {
return ("This file type is not supported.");
}
else {
return ("This file exceeds the maximum allowed size of 80 KB.");
}
}
else {
return ("not correct extension.");
}
}
I am using Telerik.Web.UI v2015.2.623.45.
If I set the allowed file extensions like this:
AllowedFileExtensions="txt,jpg,JPG"
it does not throw the error.
Any suggestions as to why this is happening would be appreciated.
Thanks,
Ray Goforth
For such client-side validation you should use the following condition instead:
if
(sender.get_allowedFileExtensions().toLowerCase().indexOf(fileExtention.toLowerCase()) == -1) {
return
(
"This file type is not supported."
);
}
Please give it a try and let me know if the issue is resolved.
Regards,
Konstantin Dikov
Telerik
Hi Konstantin,
Thanks very much for the code. This does resolve the issue but I see why some people are experiencing this case sensitivity when others are not. The issue only happens when the maximum size has been exceeded. For instance:
Lets say that my allowed file types is "jpg" and my max size is 80kb.
If I try to upload a file "test.jpg" that is 85kb, the error says "This file exceeds the maximum allowed size of 80 KB.", which makes sense.
If I rename the file to "test.JPG" and try to upload it, the error says "This file type is not supported."
Thanks for your help!
Ray Goforth
Is there any progress on this issue? Ray's post in October 2015 is still happening in the demos. (see attached image).
It is easy to resolve the error in aspx by just duplicating our 20+ allowed types, but this seems like a workaround the bug.
Also, is there any interest in adding a DISallowed file extensions property?
Thanks,
Andrew
I am still not able to replicate the issue with the file extensions in our online demo:
I am attaching a screenshot with the result on my side.
As for the Disallowed option, we do not have plans for introducing such property, but you can log this as a feature request in our public portal:
Best Regards,
Konstantin Dikov
Telerik by Progress