duan4739 2018-12-05 04:44
浏览 71
已采纳

在服务器上传后,Laravel Voyager图像被破坏

Laravel Version: 5.5 Voyager Version: 1.0 PHP Version: 7

I have uploaded my laravel project in cPanel. Previous images are shown successfully but the newly added images are not showing.

enter image description here

Here last 2 images are already in the project before uploading in cPanel. After uploading the project successfully in cPanel I have try to upload an image but it is not shown which is first one.

Anybody help ?

i tryed with change in config/filesystem.php

Change the path from storage_path() to public_path().

'public' => [ 'driver' => 'local', 'root' => public_path('app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', ],

but it not worked. please help me!

broken image url- http://example.com/storage/products/December2018/QIDyzoFg1aAf6NUGMJtZ.jpg

  • 写回答

1条回答 默认 最新

  • dongshu9458 2018-12-09 10:54
    关注

    i found the solution ! the promblem was in the symlink(storage symbolic link). in the localhost we can easily create the symlink from voyager adminpannel or in terminal php artisan storage:link in that case in shared hosting we cannot do that .see below what i do.

    1.log in to the cpannel

    2.go the project folder then go public->storage folder then rename it to storage old or somthing.

    3.come back to the cpannel main menu and select the cron job

    4.in common settings --> select *once per 5 minutes

    5.in the command field add this ln -s /home/cpanel_username/project_name/storage/app/public /home/cpanel_sername/project_name/public/storage

    (my site was in subdomain) example-ln -s /home/your_cpannel_user name/public_html/subdomain_foldername/storage/app/public /home/cpanel_username/public_html/subdomain_foldername/public/storage

    syntax-->ln -s target_path link_path

    6.type your email in the cron email and update email(when the job was done email notification wiil come to your inbox check the spam folder)

    6.create new cronjob

    7.wait few minutes you almost done.! after the execution delete the cronjob

    8.log and check upload path working correctly!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元