'Failed to load resource: the server responded with a status of 500 (Internal Server Error) when uploading an image

Im trying to upload a picture from my registration form but I get

Failed to load resource: the server responded with a status of 500 (Internal Server Error).

It only happens in the User default model given by laravel. Does this really persist when using this model?



Solution 1:[1]

Error-Failed-to-load-resource-the-server-responded-with-a-status-of-500

Getting a 500 Internal Server Error

solution #1:

in my case i take the pull from the github and change then checkout to new branch,so the composer did npot install the new packeges in server.

Install the required packages by running the composer command from the the root of the project:

sudo composer install

UPDATE: You should not run this command on a production server, but some issues with composer can be resolved with this on local envs. EDIT:

take a look at https://getcomposer.org/doc/faqs/how-to-install-untrusted-packages-safely.md to see why running composer install as root is not a good idea. If you need to run it as root, provide the following flags to block third-party code from executing durin the install --no-plugins --no-scripts

solution #2:

For solving the problem i ran the following commands through terminal.

sudo chmod -R 755 MYlaravel_project

and then type below to allow laravel to write file to storage folder

chown -R www-data:www-data /path/to/your/root/dir/
chmod -R 775 /bootstrap
chmod -R 775 /storage

After that clear your caches using the below commands:

//---Delete Configuration Cahce

php artisan config:cache

//---Clear Application Cache

php artisan cache:clear

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SyedAsadRazaDevops