Doubt storageAs Laravel 5.4

0

I was with my local Laravel project, and I use this code to save my images:

$request->profile_photo->storeAs('empresas/perfil', $filename, 'public');

Now I have hosted my project, to host I had to get the folder public from the project root, it is at the same project level and is called public_html .

When saving an image, it displays the following error:

  

(1/1) ErrorException   fopen (/ storage / ssd3 / 972/3511972 / public_html): failed to open stream: Is a directory   in FilesystemAdapter.php (line 160)   at HandleExceptions-> handleError (2, 'fopen (/ storage / ssd3 / 972/3511972 / public_html): failed to open stream: Is a directory' / '/ storage / ssd3 / 972/3511972 / laravel / vendor / laravel / ('File' = > '../companies/profile', 'file' => object (UploadedFile), 'name' => ' Laravel_foto_perfiliuyuiwayeatgmailcom_teste.jpg ',' options' => array ()))   at fopen ('/ storage / ssd3 / 972/3511972 / public_html', 'r +')   in FilesystemAdapter.php (line 160)

What do I need to change to fix the problem?

    
asked by anonymous 21.11.2017 / 19:17

1 answer

-1

Most likely your mistake, as it was with me, is related to the size of the image you are sending to the server.

The php has the configuration file called php.ini and contains some settings such as the maximum file size ( upload_max_filesize , where the default value is 2MB) and the maximum size of the request made using the POST method ( post_max_size , where the default value is 8MB).

If your image is larger than these settings the file will not be available for you to handle or save.

In this way, the error happens when fopen is called internally by the storeAs method and uses the actual image path ( $file->getRealPath() ) that is not available due to image size limitation.

    
16.05.2018 / 21:18