为什么dropzone在上传后没有刷新页面?

时间:2018-03-10 18:12:00

标签: javascript html node.js dropzone.js

我一直在处理文件上传,并希望在完成使用dropzone上传文件时刷新页面。但是,我正在尝试,但我运气不好 这是我的dropzone html。

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
  <tr>
    <td>1</td>
    <td class="demand">DL-001</td>
    <td>Description 1</td>
  </tr>
  <tr>
    <td>2</td>
    <td class="demand">DL-002</td>
    <td>Description 2</td>
  </tr>
  <tr>
    <td>3</td>
    <td class="demand">DL-003</td>
    <td>Description 3</td>
  </tr>
</table>

包含所有配置的删除文件

 <form method='post' action='/events/{{eventName}}/upload' enctype="multipart/form-data" class="dropzone" id="myAwesomeDropzone">

            <div class="fallback">
                <input name="file" type="file" multiple />
            </div>

        </form>

最后我的服务器文件处理上传:

Dropzone.options.myAwesomeDropzone = {
paramName: "userPhoto", // The name that will be used to transfer the file
maxFilesize: 20, // MB
maxFiles: 1,
acceptedFiles: ".jpeg,.jpg",
dictDefaultMessage: 'Drag an image here to upload, or click to select one',
init: function () {
    // Set up any event handlers
    this.on("complete", function (file) {
        if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) {
          location.reload();
        }
      });
}};

});

为什么页面没有重新加载?

0 个答案:

没有答案