Solutions to laravel image upload failure: 1. Enable file upload in the PHP configuration file; 2. Install the extension "fileinfo"; 3. Close open_basedir; 4. Rewrite the path.
The operating environment of this article: linux5.9.8 system, Laravel version 5.7, MacBook Air 2019 computer.
laravel What should I do if the image upload fails?
linux server laravel project failed to upload images
##Summary The following reasons occur: 1.Linux file permissions problem, (make sure the upload directory file permissions are '777')2.PHP configuration file enables file upload ----------Pagoda----------------------------------------- ------------------
Under normal circumstances, you can upload it here. If you still Tip
Upload failedThen check the error log Log location:
1 |
|
PHP warning: Unknown:
open_basedirThe restriction is valid. File (/tmp) is not within an allowed path: (/www/wwwroot/) in unknown at line 0 PHP message: PHP warning: File upload error - Cannot create temporary file in "unknown" at line 0,
Related recommendations:
The above is the detailed content of What to do if laravel image upload fails. For more information, please follow other related articles on the PHP Chinese website!