File not found error while moving image in Laravel

Asked

Viewed 73 times

0

I’m trying to move an image that’s located inside storage/temp for storage/app/public/erro_log with the method Storage::move();, but I get the error of File not found, even if the image is at the place of origin.

For the test I ended up isolating the method:

Storage::move(storage_path('temp/erro.png'), storage_path('app/spublic/erro_log/123.png'));

Error print: Erro print

In summary when moving the image to another destination I am getting the error saying that it does not exist even if it is in the log location, (just copy and paste the path in the terminal that the image opens).

@EDIT I tested following the same logic on Linux and generated the same error File not found.

I appreciate any help.

  • I believe you should configure the disk that you will use to save, move, etc... in the file root_folder\config\filesystems.php. Following the documenting

  • I ended up solving the problem, but I did not find how to change this parameter.

1 answer

0


Doing the tests I ended up solving the problem, so I understood the function storage_path(); and the method Storage::move(); by default they already work inside the directory storage/.

For example, to move a file from the directory temp to the directory app command would be:

Storage::move('temp/test.png', '/app/test.png');

In the case the past path is the relative not the complete path var/www/html... That goes for the Storage::delete(); and probably for everyone else.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.