Кажется, метод jQuery attr () не работает в IE8 для атрибута enctype. Например:
f=$('<form>');
f.attr({"target":"ta","id":"idx"});//OK - FF and IE8
f.attr("method","post");//OK - FF and IE8
f.attr("enctype","multipart/form-data");//OK in FF, but not in IE8!!!
IE8 не отправляет содержимое файла через загрузку. Но есть простое решение:
f=$('<form enctype="multipart/form-data" />');//FF and IE8
страница подтверждения:
<html>
<head>
<title>Example page for jQuery attr() bug - it can't set enctype attribute in form tag</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
//next two lines don't work in IE8, but they work in FF
f=$('<form />');
f.attr("enctype","multipart/form-data");
//comment two previous lines, uncomment next line and it work in IE8
//f=$('<form enctype="multipart/form-data" />');
f.attr("method","post");
f.append('<input type="file" name="ffile" id="ffile" /><input name="fsubmit" id="fsubmit" type="submit">');
$(document.body).append(f);
});
</script>
</head>
<body>
<p>
<?php
if(@basename(htmlspecialchars($_FILES['ffile']['name'])))echo "Browser has sent a file ".$_FILES['ffile']['name'];
else echo "Browser hasn't sent a file.";
?>
</p>
</body>
</html>