Skip to main content
Nintex Community Menu Bar
Question

How to restrict the File Upload only to images?

  • July 10, 2024
  • 4 replies
  • 15 views

Forum|alt.badge.img+5

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?

This topic has been closed for replies.

4 replies

Forum|alt.badge.img+17
  • Nintex Employee
  • July 10, 2024

Prior conversations have suggested that this sort of validation would probably best be done in APEX…

https://community.skuid.com/t/file-upload-type


Forum|alt.badge.img+5
  • Author
  • July 10, 2024

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>


Forum|alt.badge.img+17
  • Nintex Employee
  • July 10, 2024

Sweet!  Good work Thimo…


Forum|alt.badge.img+1
  • July 10, 2024

Hi Thimo, I have similar requirement. How can we call this snippet from file upload button?