Skip to content

Commit 0b5694e

Browse files
committed
Updated response when uploading
1 parent c5ed14e commit 0b5694e

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

src/Controllers/UploadController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function upload()
4343
}
4444

4545
if (is_array($uploaded_files)) {
46-
$response = count($error_bag) > 0 ? $error_bag : parent::$success_response;
46+
$response = count($error_bag) > 0 ? $error_bag : $new_filename;
4747
} else { // upload via ckeditor 'Upload' tab
4848
if (is_null($new_filename)) {
4949
$response = $error_bag[0];

src/LfmPath.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public function upload($file)
256256
// TODO should be "FileWasUploaded"
257257
event(new ImageWasUploaded($new_file_path));
258258

259-
return $new_file_name;
259+
return $this->pretty($new_file_name)->fill()->attributes;
260260
}
261261

262262
private function uploadValidator($file)

src/views/index.blade.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -234,19 +234,14 @@
234234
paramName: "upload[]", // The name that will be used to transfer the file
235235
uploadMultiple: false,
236236
parallelUploads: 5,
237-
timeout:0,
237+
timeout: 0,
238238
clickable: '#upload-button',
239239
dictDefaultMessage: lang['message-drop'],
240-
init: function() {
241-
var _this = this; // For the closure
242-
this.on('success', function(file, response) {
243-
if (response === 'OK') {
244-
loadFolders();
245-
} else {
246-
this.defaultOptions.error(file, response.join('\n'));
247-
}
240+
init: function () {
241+
this.on('success', function (file, response) {
242+
loadFolders();
248243
});
249-
this.on('error', function(file, response) {
244+
this.on('error', function (file, response) {
250245
if (response.message !== undefined) {
251246
this.defaultOptions.error(file, response.message);
252247
}

0 commit comments

Comments
 (0)