2

我正在使用 dropZone 来拖动和上传文件,但不知何故它不起作用。我在 Mac OS 中。我已为上传的文件夹授予 777 权限,但仍然没有上传。这是我的代码:

$(document).on('change','#type',function(){
      var type = $('#type').val();
      var course = $('#course').val();
      alert(type); alert(course);
      if(type != "" && course!= ""){
        $('#file_upload').show();
        Dropzone.options.dropzoneForm = {
            paramName: "uploadMultiple",
            maxFilesize: 5,
            dictDefaultMessage: "<strong>Drop files here or click to upload. </strong></br>",
            acceptedFiles: type,
            renameFile: 'course',
            url: "../files/course/"+course+"/",
            init: function () {
              this.on("complete", function (file) {
                if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) {
                  alert('File Uploaded');
                }
              });
            }
        };
      } else {
        $('#file_upload').hide();
      }
    })
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src ="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.4.0/dropzone.js"></script>
<select type="text" class="form-control" id="course" required>
      <option value="" selected disabled>Select Course</option>
      <option value="1">Development</option>
</select>

<select type="text" class="form-control" id="type" required>
      <option value="" selected disabled>Select File Type</option>
      <option value="application/pdf">PDF</option>
</select>
          
<div id="file_upload">          
  <form action="#" class="dropzone" id="dropzoneForm">
   <div class="fallback">
        <input name="file" type="file" multiple />
     </div>
 </form>
</div>

我在这里做错了什么?

4

0 回答 0