【发布时间】:2012-05-21 20:42:19
【问题描述】:
我使用隐藏的 iframe 方法提交文件而不加载新页面,它适用于除 Internet Explorer 之外的所有浏览器,这对于其他顶级浏览器来说很奇怪。
表单和 iframe 如下所示:
<iframe id="hidden_upload" style="display:none" src="" name="hidden_upload" ></iframe>
<form class="" action="upload.php" method="post" target="hidden_upload" enctype="multipart/form-data" id="uploadForm">
<table>
<tbody>
<tr>
<td><label for = "title">Title: </label></td>
<td><input type="text" name="title" id="title" maxlength="40" style="width:300px;"/></td>
</tr>
<tr>
<td><label for="description">Description: </label></td>
<td><textarea id="description" name="description" style="width:460px;height:135px;"></textarea></td>
</tr>
<tr>
<td><label for="file">File: </label></td>
<td><input type="hidden" name="MAX_FILE_SIZE" value="3145728" /><input id="file" type="file" name="file"/></td>
</tr>
</tbody>
</table>
<center><input type="submit" value="Upload" id="filesubmit" onclick="return submitting()"/></center>
</form>
我有另一个页面可以在 IE 中运行,在文档类型或表单和 iframe 结构方面没有明显差异。
这也不是上传页面的标题,因为我尝试将工作表单的操作设置为非工作表单的上传页面,它仍然在 IE 中工作。
submitting 函数正在运行,返回 true。
编辑:
为简洁起见,这也不起作用:
<form class="" action="upload.php" method="post" target="hidden_upload" enctype="multipart/form-data" id="importForm">
<input type="submit" />
</form>
<iframe id="hidden_upload" style="display:none" src="" name="hidden_upload" ></iframe>
编辑:这完全是荒谬的。我将工作页面逐字复制到非工作页面中,但仍然无法正常工作。唯一的区别是目录,.htaccess 文件是相同的。
【问题讨论】:
-
我发现问题请回复,我也面临同样的问题
-
@PRASANTH,我希望我能记住做任何事都只是侥幸。无论做什么,都不要放弃。
标签: forms internet-explorer iframe submit