Dropzone 停在进度条上

Dropzone stops on the progress bar

这很难解释,因为我没有现场演示。我使用一个简单的 dropzone。

HTML:

<form action="http://localhost/upload.php" class="dropzone" method="post" id="upload-widget"></form>

JavaScript:

Dropzone.options.uploadWidget = {
    uploadMultiple: false,
    maxFilesize: 2, // MB
    maxFiles: 1,
    acceptedFiles: 'image/*',
    init: function() {
        this.on('success', function() {
            alert('OK);
        });
    }
};

upload.php 文件:

if(!empty($_FILES)){
    $targetDir = "uploads/";
    $fileName = $_FILES['file']['name'];
    $targetFile = $targetDir.$fileName;
    if(move_uploaded_file($_FILES['file']['tmp_name'],$targetFile)){
        //insert file information into db table
    }
}

当我选择或放下一个文件时,它会上传,但停在进度:

我不知道为什么。当我上传任何文件时,文件出现在 /uploads/ 文件夹中,但似乎 dropzone.js 在完成时没有反应。我需要打印一些数据吗?我用这个网站作为教程http://www.codexworld.com/drag-and-drop-file-upload-using-dropzone-php/

尝试像这样使用 success 事件:

Dropzone.options.uploadWidget = {
    uploadMultiple: false,
    maxFilesize: 2, // MB
    maxFiles: 1,
    acceptedFiles: 'image/*',
    success: function(file, res) {
        console.log('Upload success.');
        console.log(res);
    },
    error: function(file, res) {
        console.log('Upload error.');
        console.log(res);
    }
};

我发现了问题。我正在使用这个 PHP 调试器:https://github.com/JosephLenton/PHP-Error 由于某些未知原因禁用接收 XHTTP 响应(有趣的是我的网站在 ajax 中几乎是完整的而且我没有注意到任何错误)。无论如何,我不能在这个调试器中使用 dropzone.js。我可以接受它(当它投入生产时它也会被关闭)。