I've reviewed all similar questions and answers here but didn't find anything helpful for me :( I need to store file, I have a code that 100% works but when I try to upload big file (actually not very big - 2.5MB) I'm getting an error
(1/1) ErrorException
fopen(/home/user/Projects/foobar/public): failed to open stream: Is a directory
This problem is 100% due to file size (not with path or name because I can successfully upload another files from the same directory) because I've already tried to change permissions, moved content to new file but it didn't help.
Also I've changed nginx
client_max_body_size 100m;
and PHP configuration
upload_max_filesize = 100M
post_max_size = 100M
I was developing on the local server using angular 5 and Laravel running locally on 127.0.0.1:8000 and I was experiencing the same error when trying to upload files larger than 2M. I don't know about nginx but here is how I solved my error:
In my etc/php/7.1
folder there is cli
and apache2
, both of which have php.ini
. Changing upload_max_filesize
and post_max_size
in the php.ini inside apache2 alone did not solve the error. Then I realized that since I was running laravel from php artisan serve, cli might have something to do with it.
Finally, I also opened php.ini inside the cli folder and made changes to upload_max_filesize
and post_max_size
, restarted apache2 by running
sudo service apache2 restart
Then quit php artisan server and ng server and restarted them. Now everything works fine!
This might help somebody out there with a similar problem