We have learnt of the features and usage of the Unisharp file manager in the previous tutorials. One of the main feature of the package is to upload files and images. However, at times it fails to do so, that can be due to many reasons. Let’s discuss some possible cases why you may get the error of ‘UniSharp file manager not uploading a file’.
Check APP_URL in .env file
As explained in the tutorial on how to use Uni in Laravel, you should change the APP_URL variable in the .env files. So when using your application on a separate port or server, you should be careful to change the APP_URL accordingly.
Checking and changing your APP_URL="localhost"
to the port number you are using (for example, : APP_URL=http://127.0.0.1:8000
) might solve your upload fail problem.
Link application storage to public
UniSharp package uses intervention/image
to create a thumbnail and keeps it inside storage/app/public/
by default. Therefore, the images or files should be stored in the public_path directory by default.
Make sure to link your storage and public directories. Or create a symlink using the command php artisan storage:link
.
Add exif as a dependency
Exif (Exchangeable image information) is a php extension that allows you to work with image metadata. Enabling exif can solve your image uploads problems in Laravel. Upload scripts from laravel-filemanger tries to rotate the image based on it’s orientation. But fails without exif. Therefore nothing returns and uploads fail.
You can check your php modules and see if exif is in list and enabled.
php -m | more
Hope the guide helped you solve your error for UniSharp file manager not uploading file or images.