Index: filefield.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/filefield/filefield.js,v retrieving revision 1.10 diff -u -p -r1.10 filefield.js --- filefield.js 26 Nov 2008 00:49:33 -0000 1.10 +++ filefield.js 3 Dec 2008 21:33:56 -0000 @@ -5,20 +5,20 @@ */ Drupal.behaviors.filefieldValidateAutoAttach = function(context) { $("input[@type='file'][accept]", context).change( function() { - $('.filefield-js-error').remove(); + // Remove any previous errors. + $('.file-upload-js-error').remove(); /** * Add client side validation for the input[@file] accept attribute. */ - if(this.accept.length > 1){ - accept = this.accept.replace(/,/g, '|'); - v = new RegExp('\\.(' + (accept ? accept : '') + ')$', 'gi'); + if (this.accept.length > 1) { + var v = new RegExp('\\.(' + this.accept.replace(/,\s*/g, '|') + ')$', 'gi'); if (!v.test(this.value)) { var error = Drupal.t("The selected file %filename cannot not be uploaded. Only files with the following extensions are allowed: %extensions.", - { '%filename' : this.value, '%extensions': accept.replace(/\|/g, ', ') } + { '%filename' : this.value, '%extensions' : accept.replace(/\|/g, ', ') } ); - // what do I prepend this to? - $(this).before('
' + error + '
'); + // What do I prepend this to? + $(this).before('
' + error + '
'); this.value = ''; return false; }