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.
– Diego Souza
@Peterparker, I’m not sure how to do the route. The routes I do are usually the
Route::get('url', 'AlgumController@metodo');
orRoute::get('url', function(){
 return algumacoisa;
});
What should I return on the route?– Amanda Lima
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.– Diego Souza
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 ?– Amanda Lima
Ah, now I understand what you mean. Kcfinder itself Uploads...
– Diego Souza
I found this on Soen: http://stackoverflow.com/a/36688258
– Diego Souza
Yes, but when I click on the image upload button, it gives error, says the route does not exist
– Amanda Lima
You managed to make ?
– Diego Souza
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.– Diego Souza