获得文件大小上传之前 [英] Get file size before uploading
本文介绍了获得文件大小上传之前的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法找出文件的大小使用AJAX / PHP中输入文件的更改事件上传文件之前?
Is there any way to find out the file size before uploading the file using AJAX / PHP in change event of input file?
推荐答案
对于HTML波纹管
<input type="file" id="myFile" />
请尝试以下操作:
try the following:
//binds to onchange event of your input field
$('#myFile').bind('change', function() {
//this.files[0].size gets the size of your file.
alert(this.files[0].size);
});
请参阅以下主题:
检查与jQuery 的文件输入尺寸
这篇关于获得文件大小上传之前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文