Home>

I am a beginner studying various things.
Thank you

Thank you for taking care of I can't upload images with laravel and get an error .
Created as advised, and can be saved and displayed on blade in the local environment.
I'm having trouble deploying this in production

Error message

As the title suggests, we deployed to the Sakura server as a production environment, but when we tried to save the image

Can't write image data to path (/home/00/www/laravel/laravel-app/storage/app/public/images/uiydm.png)


And I get an error
〇〇 is hidden because it is an account name. The name of the laravel project I created is laravel-app

As shown in the above path, a laravel folder is created under www and a project folder is placed in it.
Data other than images (user information, passwords, etc.) can be stored in the DB.

Supplemental information (FW/tool version etc.)

Using laravel 5.6. It was built using a resource controller.

  • Answer # 1

    https://readouble.com/laravel/5.6/en/installation.html

  • Answer # 2

    some questions I answered the answer&because it seems better to write in the answer


    /home/OO/www/laravel/laravel-app/storage/app/public/images/
    Does this folder exist? Do you have&write permission?


      

    Image path in production environment
      
      And in a local environment
      

    For


    Assuming thatstrage/imagefolder exists underpublicfolder
    It is bad thatlaravel/laravel-app/publicis in the URL in the production environment.
    If the HTTP server of the production environment is Apache, the path will not match in the production environment and the local environment unless the root directory islaravel/laravel-app/public

    Apache
    When I wanted to launch HelloWorld with Apache Laravel

    Nginx
    A lot of stories about running laravel with nginx

    I think that it is OK if you make the public folder the root directory like

    ※ 〇〇.sakura.ne.jp is written on the assumption that only the laravel project created this time will be moved

Related articles

Trends