laravel-ckeditor
laravel-ckeditor copied to clipboard
Image upload is not working in laravel 5.2
when i try to upload image it show cross mark over there.
is there any configuration for uploading image??
please check below screen shot for more detail.
I fought this issue for a while today, but it is not an issue with this distribution - it is a simple config thing. Two steps to fix:
- As described in the Filesystem documentation, you need to make a link for the public disk:
php artisan storage:link
- If you have not already, you need to set the URL parameter in your .env file.
That was all it took and it works a charm for me now.
@bryandonwhite This command is not working in laravel 5.2. is there any other way?
All the command in step #1 does is make a symbolic link on your filesystem. This will not work if you are developing on Windows, but you can do it at a command line if you are developing on OS X or any kind of Linux / Unix:
ln -s /path/to/laravel/storage/app/public /path/to/laravel/public/storage
is there any way for windows? @bryandonwhite
https://stackoverflow.com/questions/38045119/how-to-create-symlink-from-public-storage-to-storage-app-public-in-laravel solution is: App::make('files')->link(storage_path('app/public'), public_path('storage'));
but still i am getting issue in above answer.
@bryandonwhite is there any solution for windows than let me know
I'm sure there is a solution for windows, but I am not an expert on the Laravel storage concepts AT ALL. Hopefully someone else reads this that can assist...
You are getting "method link does not exist" because Windows does not have a concept of symbolic links.
https://laravel.com/api/5.2/Illuminate/Filesystem/Filesystem.html#method_link
@bryandonwhite laravel 5.2 does not support link method. is there any other way?
I think you will need to read the Storage laravel docs and figure out how to map a path that is accessible in public, but I personally do not know how to do that.
Actually, you are using WAMP, you could do it with an Apache rewrite rule - is that more something you know how to do?
@bryandonwhite I found one solution for laravel 5.2 in windows.
App::make('files')->copyDirectory(storage_path('app\public\uploads'), public_path('storage\uploads'));
there is one function to copy whole directory its working for me now. when i move my code in Linux i will use command which is given by you.
Excellent, glad you found a solution - and a decent one, too. I might not have thought of that. Will it work for every upload in the future? Or, will you need a function (probably in your controller) that copies new uploads?
I put that code in boot method of AppServiceProvider.php so it will call every time when page load. so it copy images from that folder to public director folder. I know its not proper solution but currently this solution is fine for me.
I agree, things that work are good, even when they are not "proper" :-) Just remember to have an easy way to roll that stuff back to an accepted practice when you go to deploy to a production server.
@bryandonwhite sure i will. Thank you.
The best approach should be to publish config with storage disc to laravel config dir, and merge it in service peovider. It will be more flexible, i think.
Agreed. Can you submit a PR for that?