dongzhuo5185 2019-02-05 10:29
浏览 39
已采纳

将项目从localhost移动到cpanel后,Laravel需要更改public_path以上载文件

I have project working fine on localhost and can upload images with no issues but now I moved the project to be online on capnel the problem is when I upload image it goes to public folder while I want it to be upload to main root: example: site.com/images/file.jpg but now the upload file goes to site.com/public/images/file.jpg so how can I avoid uploading to public folder as I want to upload to images folder directly.. I tried to modify filesystems in config but not working

 'disks' => [

   'local' => [
    'driver' => 'local',
    'root' => public_path('/images'),
    ],

    'public' => [
    'driver' => 'local',
    'root' => storage_path('app/public'),
    'url' => env('APP_URL').'/uploads',
      'visibility' => 'public',
   ],
  • 写回答

1条回答 默认 最新

  • drvntaomy06331839 2019-02-05 10:31
    关注

    Change the root variable from:

      'root' => public_path('/images'),
    

    to

      'root' => '/images',
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测
  • ¥88 python部署量化回测异常问题
  • ¥30 酬劳2w元求合作写文章
  • ¥15 在现有系统基础上增加功能
  • ¥15 远程桌面文档内容复制粘贴,格式会变化