This is a migrated thread and some comments may be shown as answers.

AllowedFileExtensions case insensitive?

8 Answers 432 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 30 Mar 2015, 12:19 PM
AllowedFileExtensions on RadAsyncUpload is case sensitive. So when setting AllowedFileExtensions to "doc, docx" it won't accept any DOC or DOCX extensions. How can I enable AllowedFileExtensions to be case insensitive?

8 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 02 Apr 2015, 06:34 AM
Hi Martin,

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.

 
0
Kallie
Top achievements
Rank 1
answered on 02 Jul 2015, 08:11 PM

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

0
Konstantin Dikov
Telerik team
answered on 06 Jul 2015, 11:17 AM
Hi Kallie,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ray
Top achievements
Rank 1
answered on 22 Oct 2015, 03:26 PM

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

 

Allen
Top achievements
Rank 2
Iron
Veteran
commented on 28 Sep 2021, 06:47 PM

Extension,  not Extention, but that is just a typo.
0
Konstantin Dikov
Telerik team
answered on 26 Oct 2015, 02:01 PM
Hi Ray,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ray
Top achievements
Rank 1
answered on 26 Oct 2015, 08:17 PM

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

 

0
Andrew
Top achievements
Rank 1
answered on 25 Jan 2017, 10:28 PM

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

0
Konstantin Dikov
Telerik team
answered on 30 Jan 2017, 02:39 PM
Hi 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
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
AsyncUpload
Asked by
Martin
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Kallie
Top achievements
Rank 1
Ray
Top achievements
Rank 1
Andrew
Top achievements
Rank 1
Share this question
or