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',
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀