Hello
I am trying to upload an image in file manager . Everything is ok but when my upload completed file manager should reload page automatically but it does not happen and I have to refresh my page to see my uploaded image
This is my error in console : TypeError: response.join is not a function
I have the same problem, any solution?
Add the following codes to the vendor/unisharp/laravel-filemanager/public/script.js line 178:
data = data.replace(/\s/g,'');
And resources/view/vendor/laravel-filemanager/index.blade.php line 202:
response = response.replace(/\s/g,'');
fix it on
vendor\unisharp\laravel-filemanagersrc\Controllers\UploadController.php
replace
line 60
return count($this->errors) > 0 ? $this->errors : parent::$success_response;
by
return count($this->errors) > 0 ? $this->errors : array(parent::$success_response);
fix it on
vendor\unisharp\laravel-filemanagersrc\Controllers\UploadController.php
replace
line 60
return count($this->errors) > 0 ? $this->errors : parent::$success_response;
by
return count($this->errors) > 0 ? $this->errors : array(parent::$success_response);
Wouldnt changing in vendor file replace when I composer install in the production server?
now fix it on
vendor\unisharp\laravel-filemanagersrc\Controllers\UploadController.php
replace
line 46
$response = count($error_bag) > 0 ? $error_bag : parent::$success_response;
by
$response = count($error_bag) > 0 ? $error_bag : array(parent::$success_response);
I am still encountering a problem when new images is uploaded. It did not work with the listed answers.
It does not refresh and thus prompts me an error with the following:
filemanager?type=image:1349 Uncaught TypeError: response.join is not a function
at d.<anonymous> (filemanager?type=image:1349)
at d.a.emit (dropzone.min.js:1)
at d._finished (dropzone.min.js:1)
at XMLHttpRequest.<anonymous> (dropzone.min.js:1)
The script it sends the error is:
<script>
Dropzone.options.uploadForm = {
paramName: "upload[]", // The name that will be used to transfer the file
uploadMultiple: false,
parallelUploads: 5,
timeout:0,
clickable: '#upload-button',
dictDefaultMessage: lang['message-drop'],
init: function() {
var _this = this; // For the closure
this.on('success', function(file, response) {
if (response == 'OK') {
loadFolders();
} else {
this.defaultOptions.error(file, response.join('\n'));
}
});
},
headers: {
'Authorization': 'Bearer ' + getUrlParam('token')
},
acceptedFiles: "image/jpeg,image/pjpeg,image/png,image/gif,image/svg+xml,application/pdf,text/plain",
maxFilesize: (50000 / 1000)
}
</script>
Most helpful comment
fix it on
vendor\unisharp\laravel-filemanagersrc\Controllers\UploadController.php
replace
line 60
return count($this->errors) > 0 ? $this->errors : parent::$success_response;
by
return count($this->errors) > 0 ? $this->errors : array(parent::$success_response);