I want users to be able to upload images via the File Upload Component. But nothing prevents them from uploading any file.
Does anyone know how to restrict that?
Page 1 / 1
Prior conversations have suggested that this sort of validation would probably best be done in APEX…
https://community.skuid.com/t/file-upload-type
Temporary fixed it with javascript.
For anyone interested:
$('INPUT[type="file"]').change(function (event) { var ext = this.value.match(/.(.+)$/)[1]; switch (ext) { case 'jpg': case 'jpeg': case 'png': case 'gif': break; default: alert('This Filetype is not supported.'); this.value = ''; window.stop(); } });<br>
Sweet! Good work Thimo…
Hi Thimo, I have similar requirement. How can we call this snippet from file upload button?
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.