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
精彩评论