We are using your current implementation for file type restrictions, but we were hoping you could add additional validation that occurs after the upload starts that throws an error if the upload isn't of the specified file type. Effectively ensuring no incorrect file types can be uploaded if a user changes the file explorer filter.
Define accepted file types on File upload control and perform additional validatation over the uploaded file
Answers approved by surveyjs Support
Hello Tyler,
The File question type uses the HTML <input> tag. The acceptedTypes property is passed to the accept
attribute of the <input> tag. For more information on this setting, refer to # HTML <input> accept Attribute.
If you wish to perform additional validation over the uploaded content, handle the survey.onUploadFiles event to validate the uploaded file and prevent a particular file from being uploaded.
The following demo shows a File question example: Upload file - File question.
Let me know if you have any questions or require further assistance.
Thank you