<SCRIPT type = "text/JavaScript"> Function check () {var filename = $ ("# addfiles_myfile "). val (). trim (); If (filename = '') {alert (" select the file to upload "); Return false;} If (filename. indexof ('#')> = 0) {alert ('There cannot be a well number in the file name'); Return false;} If (filename. indexof ('+')> = 0) {alert ('the file name cannot contain the plus sign '); Return false;} If (filename. indexof ('')> = 0) {alert ('the file name cannot contain spaces'); Return false;} var Reg = /(\. zip | \. RAR | \. JS | \. CSS | \. XML | \. 7z | \. ICO | \. PDF | \. PPT | \. pptx | \. xap | \. xpi | \. SWF | \. APK | \. CDF) $/ig; If (! Reg. test (filename) {var supporttype = reg. tostring (). replace (// |\( |\) |\|/ig, ''); supporttype = supporttype. substring (0, supporttype. length-3); supporttype = supporttype. replace (// |/g, ''); alert ('This file type is not supported! \ N supported file types: '+ supporttype); Return false;} return true;} </SCRIPT>
A Good File Upload judgment