Firefox 4:File.url如何工作?

时间:2010-11-22 08:30:45

标签: firefox

是否在this page中说明了,但在我的Firefox 4 Beta 7中未定义。

<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
function read(files) {
 var myFile = files[0];
 document.write(myFile.url);
}
</script>
</head>
<body>

 <input type="file" onchange="read(this.files);" />

</body>
</html>

2 个答案:

答案 0 :(得分:0)

我认为this page会更有用;)

答案 1 :(得分:0)

我不知道为什么它不适用于目前的测试版。我不认为标准是非常稳定的,因此自文章撰写以来,file.url可能已被删除。我在the current API draft中找不到任何相关内容。

如果您使用createBlobURL(myFile)代替myFile.url

,您似乎在FF 4 beta 7中获得相同类型的网址