— FILE UPLOAD field —
I would be great that we could control which file types are allowed to upload.
1.- Security reasons
2.- To avoid misunderstandings and have to request a new file from the customer
Open
Last updated: November 5, 2019
Log in to comment on this feature request.
This script works.
But it would be better that it were a feature of the plugin.
jQuery('div.wc-pao-addon-my-field input.wc-pao-addon-file-upload').on('change', function() { var ext = jQuery('div.wc-pao-addon-my-field input.wc-pao-addon-file-upload').val().split('.').pop().toLowerCase(); if ( ext ) { if ( jQuery.inArray(ext, ['jpg','jpeg']) == -1 ) { alert('Only JPG files are allowed. You have uploaded a ' + ext.toUpperCase() + ' file'); jQuery('div.wc-pao-addon-my-field input.wc-pao-addon-file-upload').val(''); } } })