如何使用Jquery和Jquery表单验证插件检查上传文件的大小? [英] How to check the size of an uploaded file using Jquery and Jquery form validation plugin?

查看:90
本文介绍了如何使用Jquery和Jquery表单验证插件检查上传文件的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在客户端上实现Jquery验证.当用户要上传文件时,Jquery将检查文件的大小,如果超过最大大小,则用户将无法上传文件.如何使用Jquery或Jquery验证插件来做到这一点?

I want to implement the Jquery validation on the client. When a user is going to upload a file, the Jquery will check the size of the file and if it exceeds the max size, a user can not upload the file. How to do it using Jquery or Jquery validation plugin?

推荐答案

您无法使用JQuery做到这一点.问题是javascript无法访问文件系统.

You can't do it with JQuery. The problem is that javascript can not access the file system.

以下是您可以阅读的有关该主题的内容-使用jQuery,限制文件上传前的大小

Here is something you can read about the subject - Using jQuery, Restricting File Size Before Uploading

这篇关于如何使用Jquery和Jquery表单验证插件检查上传文件的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆