Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
[Web Upload] Limit File Type in System File Selection Window
posted

Hi,

I'm looking for some assistance with the Web Upload control featured in the Infragistics.Web.jQuery library.

When the user hits the add button to upload a file and the system's file explorer/file selection window pops-up we need that window to limit the types of files the user can see. Meaning if I only allow the users to upload .jpg, .pdf or .txt files they should ONLY see those types of files when they browse the file selection window, things like .exe .png etc should not show up in the file selection dialog.

Is there a way to do this with the Web Upload control or some kind of easy work around to implement this functionality?

Thank you!

Attached a screenshot to show the control I am talking about:

Parents
No Data
Reply
  • 17590
    Offline posted

    Hello Andrew,

    Thank you for posting in our community.

    What WebUpload provides out of the box is the AllowedExtensions property. You can configure which types of files will be allowed for users to upload. The file extension validation compares the selected file extension against declared in AllowedExtensions property. When the file extension validation fails, the WebUpload`s onError event is raised. The second parameter of the onError handler contains an object with property errorCode= 2 and the errorMessage = "File extension validation failed". It is up to you to decide hot to present the error to the user. However, this validation happens after a file is selected for upload and does not limit the files displayed in the system`s file explorer.

    Some additional information regarding WebUpload configuration can be found here.

    Please let me know if you need any additional information regarding this matter.

Children
No Data