【发布时间】:2016-02-17 09:22:28
【问题描述】:
我一直在尝试让文件上传在 IE8 中工作。我见过的唯一解决方案是发布到 IFrame。为什么这样做?是不是不可能有一个简单的表格,例如
<form action="test.php" method="post" enctype="multipart/form-data">
Select image to upload:
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="Upload Image" name="submit">
</form>
直接提交给PHP
if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
if($check !== false) {
echo "File is an image - " . $check["mime"] . ".";
$uploadOk = 1;
} else {
echo "File is not an image.";
$uploadOk = 0;
}
}
为什么需要 IFrame?
谢谢
【问题讨论】:
标签: javascript php html iframe