how validate file size using HTML and Javascript on client side

后端 未结 3 1002
轮回少年
轮回少年 2020-11-30 07:01

How can I validate the file size on the client side using JavaScript? I am using type=file for selecting the file

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-30 07:50

    Perhaps you could use SWFUpload instead, which is a small Flash application that handles the client side of the upload for you. From their feature list:

    • Upload multiple files at once by ctrl/shift-selecting in dialog
    • Javascript callbacks on all events
    • Get file information before upload starts
    • Style upload elements with XHTML and css
    • Display information while files are uploading using HTML
    • No page reloads necessary
    • Works on all platforms/browsers that has Flash support.
    • Degrades gracefully to normal HTML upload form if Flash or javascript is unavailable
    • Control filesize before upload starts
    • Only display chosen filetypes in dialog
    • Queue uploads, remove/add files before starting upload

提交回复
热议问题