我正在使用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();
}
})
&#13;
<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>
&#13;
你能帮我解决一下我在做错的事吗?