上传前获取上传文件的大小 [英] Getting upload file size before upload

查看:121
本文介绍了上传前获取上传文件的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户选择要上传的文件时,是否有一种方法可以在上传开始之前获得该文件的确切大小?我猜这需要用jQuery或JavaScript在客户端完成。任何想法如何?

解决方案



相反,您可以使用使用Flash的 Uploadify



在非IE浏览器中,您也可以使用HTML5读取客户端上的文件


When the user selects a file to be uploaded, is there a way I can get the exact size of this file before the upload even begins? I'm guessing this needs to be done on the client side with jQuery or JavaScript. Any ideas how?

解决方案

This cannot be done in pure Javascript in current browsers.

Instead, you can use Uploadify, which uses Flash.

In non-IE browsers, you can also use HTML5 to read files on the client.

这篇关于上传前获取上传文件的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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