skip to Main Content

Had this working but just updated my website on the server and it seems to have made all my uploaded files head to my public folder in my project rather than the public_html. Any idea on which file i must have uploaded and the fix?

2

Answers


  1. You said you had it working before.
    Was that on the same server…live?

    If so, then could that be a server issue and not necessarily laravel issue?
    Maybe you should ask your host for help and clarifications about what changed?

    If you are convinced it was about what you changed…then care to show us?
    Ideally if the server is cpanel, you will want to upload all your laravel files into your home’s directly…then all your /public folder content into public_html
    It will look like this:

    • .cpanel/

    • app/

    • etc/
    • bootstrap/
    • mail/
    • public_html/
      • content from your laravel /public directory
    • vendor/

    …etc

    You also need to go into your /public_html and edit the index.php content:

    require __DIR__.’/../vendor/autoload.php’;
    
    $app = require_once __DIR__.’/../bootstrap/app.php’;
    

    And make sure it points to the correct location of your bootstrap folder..if you follow the structure above, then its ok.

    Lastly, confirm that your PHP is indeed >= PHP7.0

    Login or Signup to reply.
  2. With help from this answer: https://stackoverflow.com/a/50261573/3475551
    I managed to get laravel to save uploaded files to my servers public directory instead of app/public.
    Edit app/Providers/AppServiceProvider.php like this:

    public function register()
    {
        $this->app->bind('path.public', function() {
            return realpath(base_path().'/../../public_html');
        });
    }
    

    Hope this helps.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search