我有这段代码:
CODE JS:
var currentFile = null;
Dropzone.autoDiscover = false;
var myDropzone = new Dropzone("div#myDrop", {
url : "<?php echo $this->serverUrl() . '/profile/ajax/dzupload'; ?>",
paramName : 'profilepicture',
acceptedFiles : "image/*",
maxFiles : 1,
addRemoveLinks : true,
init : function() {
var fileName = $('#profilePicture').val();
var mockFile = { name: fileName, size: 12345 };
this.options.addedfile.call(this, mockFile);
this.options.thumbnail.call(this, mockFile, "<?php echo $this->serverUrl().'/public/profile/'.'usr'.$practitionerInfo->user_id.'/picture/'.$practitionerInfo->profilepicture ?>");
currentFile = mockFile;
this.on("addedfile", function(file) {
if (currentFile) {
this.removeFile(currentFile);
}
currentFile = file;
});
this.on("success", function(file, responseText) {
$('#profilePicture').attr("value", responseText.filename);
console.log(responseText );
});
this.on("maxfilesexceeded", function(file){
this.removeFile(file);
alert("You are not allowed to chose more than 1 file!");
});
this.on("removedfile", function (file){
$.ajax({
method: 'POST',
url: '<?php echo $this->serverUrl() . '/profile/ajax/dzdelete' ?>',
data: {
area : 'company-profile',
name : $('#profilePicture').attr('value')
},
success: function(result){
$('#profilePicture').attr("value", '')
console.log(result);
}
})
});
}
});
错误:
Cannot read property 'removeChild' of null
导致此错误的原因是什么? 我该如何解决?
当我进入上传功能
时会发生此错误从来没有遇到过这样的错误?我怎样才能改进我的代码以便只出现这个错误?
提前致谢!
答案 0 :(得分:1)
将removedfile方法替换为此类
accuracy1 = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
在文件dropzone.js
中