Полный код страницы:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>File API Test</title>
<style>
.thumb {
height: 75px;
border: 1px solid #000;
margin: 10px 5px 0 0;
}
</style>
<script>
function changeImage(el)
{
var f = el.files[0];
if (f.type.match('image.*') != null)
showPicture(f);
else if (f.type.match('flash') != null)
showFlash(f);
else
return;
}
function showFlash(f)
{
var reader = new FileReader();
reader.onload = (function(theFile) {
return function(e) {
var div = document.getElementById('image');
div.innerHTML = '<object class="thumb" type="application/x-shockwave-flash" data="' +
(e.target.result) +'"><param name="movie" value="'+ (e.target.result) +'" />';
}
})(f);
reader.readAsDataURL(f);
}
function showPicture(f)
{
var reader = new FileReader();
reader.onload = (function(theFile) {
return function(e) {
var div = document.getElementById('image');
div.innerHTML = ['<img class="thumb" src="', e.target.result,'" title="', theFile.name, '"/>'].join('');
}
})(f);
reader.readAsDataURL(f);
}
</script>
</head>
<body>
<input type="file" id="load" name="load"/> <br />
<div id="image"></div>
<script>
if (window.File && window.FileReader && window.FileList && window.Blob) {
document.getElementById('load').onchange = function() { changeImage(document.getElementById('load')); }
}
else {
alert('The File APIs are not fully supported in this browser.');
}
</script>
</body>
</html>
Я так полагаю, что в строке:
div.innerHTML = '<object class="thumb" type="application/x-shockwave-flash" data="' + (e.target.result) +'"><param name="movie" value="'+ (e.target.result) +'" />';
как-то правильно надо задать параметр data и value.
А вот как задать?