Applying javascript to check file size and extension

前端 未结 7 821
借酒劲吻你
借酒劲吻你 2021-01-05 00:40

here is my script. What I am trying to do is to trigger it using onchange event. But it seems does not work very well. I have tried edit here and there but still facing prob

相关标签:
7条回答
  • 2021-01-05 01:09

    http://jsfiddle.net/kVdT5/

    take a look at this fiddle. It is working perfact. as i said there is change in your if condition.

    if (sFileExtension != "pdf" && sFileExtension != "doc" && sFileExtension != "docx" && iFileSize>10485760)
    

    replace it with this

    if ((sFileExtension != "pdf" && sFileExtension != "doc" && sFileExtension != "docx") || iFileSize>10485760))
    
    0 讨论(0)
提交回复
热议问题