2

对于照片上传,我将表单提交到 iframe。

表格

<form method="post" enctype="multipart/form-data" action="upload_images.php" target="iframe_pp_upload" id="dd_form">
   <input type="file" id="dd_upload" name="file">
</form>

内嵌框架

<iframe name="iframe_pp_upload" src="not-yet-submitted.php"></iframe>

jQuery

$('#dd_upload').change(function() {
  $('#dd_form').submit();
});

upload_images.php上传图片。但是,上传完成后获得反馈的最佳方式是什么?

4

1 回答 1

0

在 upload_images.php 中执行此输出:

file header......
    <script>
         window.parent.uploadReady(); 
    </script>

.....

并且在主窗口中,必须有一个js函数uploadReady(),在那里你可以为所欲为。

function uploadReady() {
      alert("im in the parent window");
 }

我希望这有帮助

于 2012-11-20T14:24:52.413 回答