开发者

Firefox 4: How does File.url work?

开发者 https://www.devze.com 2023-01-26 01:35 出处:网络
Did it as stated at this page, but got undefined in my F开发者_C百科irefox 4 Beta 7. <!DOCTYPE HTML>

Did it as stated at this page, but got undefined in my F开发者_C百科irefox 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>


I think this page will be more useful ;)


I don't know why it isn't working in the current beta. I don't think the standard is very stable yet, so file.url might have been removed since the article was written. I can't find anything about it in the current API draft.

It seems you get the same type of url in FF 4 beta 7 if you use createBlobURL(myFile) instead of myFile.url

0

精彩评论

暂无评论...
验证码 换一张
取 消