如果把下面的代码保存为:1.html之后放在桌面上双击运行,之后通过file选择文件,之后可以弹出:文件的大小.
但把1.html文件上传到服务上之后,运行弹出任何文件大小为:0.为什么啊?应当如何修改啊?
<input type="file" onchange="qq(this)"/>
<script type="text/javascript">
function qq(obj)
{
var hp = new Image();
hp.src = obj.value;
setTimeout(function(){alert(hp.fileSize);},1000);
}
</script>
但把1.html文件上传到服务上之后,运行弹出任何文件大小为:0.为什么啊?应当如何修改啊?
<input type="file" onchange="qq(this)"/>
<script type="text/javascript">
function qq(obj)
{
var hp = new Image();
hp.src = obj.value;
setTimeout(function(){alert(hp.fileSize);},1000);
}
</script>
FF3,以及IE8中都将无法通过file控件取得本文件的路径。
也就是你的程序在FF3和以后的IE8中都无法实现。