0

由于版权原因,我无法提供完整的源代码,但我会详细描述问题。

我使用 AJAX 上传来上传文件。一切都很好,除了当我choose a file, delete it outside then submit it,请求没有结束。问题发生在 Firefox 上。这是图:

在此处输入图像描述

public function inputAction()
{
    // Get request.
    $request = Request::createFromGlobals();

    if($request->getMethod() == "POST" && $request->request->has("uploadFile")) {
        var_dump("It should output this"); exit();

        // In practice, It will run to this.
        $request->request->set("finish", true);
    }

    // Set this to close loading dialog.
    $request->request->set("finish", false);

    // Render view.
    return $this->render('frontendfrontBundle:Convert:input.html.php', array("bag" => $request->request));
}

我的表格

            <form id="convertForm" method="post" action="<?php echo $view['router']->generate('Convert_input');?>" enctype="multipart/form-data" target="upload_target">

            <!-- Used for file uploading -->
            <iframe id="upload_target" name="upload_target" src="#" style="width:0;height:0;border:0px solid #fff;"></iframe> 

            <input id="uploadFile" type="file" class="width_txt" name="uploadFile"/>

            </form>

    <?php
        if($bag->get("finish", false) == true) {
    ?>
        <script>
            $(document).ready(function() {
                window.parent.stopUpload();                 
            });                  
        </script>
    <?php } ?>

脚本

$("#convertForm").submit(function(e) { // onSubmit()
        startUpload();
});
4

0 回答 0