Re: Filename pattern

  •  07-31-2012, 10:04 AM

    Re: Filename pattern

    Thanks, it works fine :)
     
    in case somebody needs it, here is a check with regex  to disallow whitespaces & special chars in file names
     
     <script>
         function CuteWebUI_AjaxUploader_OnSelect(files) {
             var re = new RegExp('^[a-zA-Z0-9\._-]+$');
             for (var i = 0; i < files.length; i++) {
                 var m = re.exec(files[i].FileName);
                 if (m == null) {
                     files[i].Cancel();
                     alert('The file "'+files[i].FileName + '" was not uploaded (unauthorized filename)');
                 } 
             }
         }  
    </script>
     
View Complete Thread