sunhater / kcfinder

KCFinder web file manager
http://kcfinder.sunhater.com
402 stars 209 forks source link

KCFinder & Json responses #155

Open ChristopheZenner opened 7 years ago

ChristopheZenner commented 7 years ago

Is it an option in the current version of KCFinder to get a json response after uploading an image? I tried version 2.51, 3.12 and 3.20 test 2.

I'm using CKEditor with the Upload Image plugin for drag&drop upload and KCFinder. File is uploading using drag&drop as it should be, but then I get an "Incorrect server response" error.

In the demo (http://sdk.ckeditor.com/samples/fileupload.html#uploading-dropped-and-pasted-images) using CKFinder, I see for example the following json response with firebug: {"fileName":"golf.jpg","uploaded":1,"url":"/userfiles/files/golf.jpg"} which works perfectly.

In my project using KCFinder, I get for example the following response:

which isn't working because no json.

Any help would be very much appreciated...

coxta commented 7 years ago

Having the same issue...

ChristopheZenner commented 7 years ago

I've changed kcfinder\core\class\uploader.php. Still testing and probably not the best solution, but everything is working now.

uploader.zip

NilsBe commented 6 years ago

I had the same issue. The changes in uploader.php are working for Upload Image by drag&drop but when uploading an image in CKEditor the usual way: Image Button in Toolbar, Upload Tab, Choose File and "Send to Server" then I get a weird Output in that dialog. There I get an iframe with the plain json result. (iframe too small, json not visible in this screenshot)

image

seamuslee001 commented 6 years ago

I faced the same issue after updating to the latest CKEditor, I was able to get it working using this PR https://github.com/sunhater/kcfinder/pull/168 and adding &format=json into the upload url. Note the file browser still needs the javascript i believe

shauryaverma4296 commented 5 years ago

image

I'm getting an issue which says incorrect server response while drag and drop. image

The response which I'm getting is '' which is not a json. Please can you tell me exactly how and from where I'm getting this response . And How will i resolve this so that i can get a json respone.

ChristopheZenner commented 5 years ago

public_html.zip

These are the files in the correct file structure that work fine for me in my projects. I can upload images by drag and drop in ckeditor, I can manually select a file and click "send it to the server", I can upload in kcfinder; browse file and upload, and even drag and drop in kcfinder.

(you have to change the upload authorisation in /kcfinder/conf/config.php. You can use a session as in my example or maybe someting else...)

Kind regards Christophe

afzafri commented 4 years ago

public_html.zip

These are the files in the correct file structure that work fine for me in my projects. I can upload images by drag and drop in ckeditor, I can manually select a file and click "send it to the server", I can upload in kcfinder; browse file and upload, and even drag and drop in kcfinder.

(you have to change the upload authorisation in /kcfinder/conf/config.php. You can use a session as in my example or maybe someting else...)

Kind regards Christophe

Thank you so much for this. I was having trouble with "invalid server response" when paste image into CKEDITOR. I just replace the original kcfinder/core/class/uploader.php.php with yours and now it's working great!