How to integrate Kcfinder with Laravel?

Asked

Viewed 180 times

2

I am making a form where the user can insert an image along with the text. Searching the internet I found Kcfinder that does exactly what I need. I integrated it with Ckeditor and so far so good. The problem is that I am developing the application with Laravel, and when I try to upload an image with Kcfinder, it gives a route error, says that it does not exist. The route doesn’t really exist, I don’t know how to create a route to the Kcfinder folder (which is in the public folder of the application). Does anyone know how?

  • Kcfinder actually has a configuration file inside it. You have to change the URL there. And then you can create a normal image upload route.

  • @Peterparker, I’m not sure how to do the route. The routes I do are usually the Route::get('url', 'AlgumController@metodo'); or Route::get('url', function(){
 return algumacoisa;
}); What should I return on the route?

  • Right. That’s right. But first you need to fix the URL in the Kcfinder configuration file. Try searching inside the folder conf the file config.php. Then there you have this line: 'uploadURL' => "upload". You place your URL that will determine on the route.

  • I found the configuration file and changed 'uploadURL'=>"upload_imagens". Now I create the route: Route::get('upload_imagens', ?);. What would come in place of ?

  • Ah, now I understand what you mean. Kcfinder itself Uploads...

  • I found this on Soen: http://stackoverflow.com/a/36688258

  • Yes, but when I click on the image upload button, it gives error, says the route does not exist

  • You managed to make ?

  • I think you have to add a line on .htaccess from inside the folder public. Before that line: RewriteRule ^(.*)/$ /$1 [L,R=301], put this on: RewriteCond %{REQUEST_URI} !^/upload which is the Kcfinder folder to upload.

Show 4 more comments

1 answer

1


I was able to solve the problem by placing the Kcfinder folder inside Laravel’s public folder. I was putting it inside the Ckeditor folder, so the Urls didn’t work

Browser other questions tagged

You are not signed in. Login or sign up in order to post.