Skip to main content
Nintex Community Menu Bar
Question

How to restrict the File Upload only to images?

  • Jul 10, 2024 12:57 PM UTC
  • 4 replies
  • 41 views
  • Translate All

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
  • Jul 10, 2024 12:59 PM UTC

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

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

Translate

Forum|alt.badge.img+5
  • Author
  • Nintex Partner
  • Jul 10, 2024 12:59 PM UTC

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>

Translate

Forum|alt.badge.img+17
  • Nintex Employee
  • Jul 10, 2024 12:59 PM UTC

Sweet!  Good work Thimo…

Translate

Forum|alt.badge.img+1
  • Jul 10, 2024 12:59 PM UTC

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

Translate