Complete BLoC with Clean Architecture (group chat) Discount !! E-commerce App With Backend Source Code Video and Voice Chatting App Firebase Chatting App Source Code Complete Gym App BLoC State Management Source Code Complete Study App Buy Ticket Booking App Source Code Buy Travel App With Backend Source Code Complete Chat App Udemy Course Special Offer Discount !! Online Learning Course App (BLoC) Online Learning Course App (Riverpod) Online Learning Course App (Getx) Discount !! Shopping App (Provider) Cool Flutter Game Flutter Nodejs Chat App Flutter Nodejs Api And Firebase Chat App Riverpod Task Management App
PHP File Upload Problem. PHP may give you two types of error
Call to a member function move() to null
PHP - mkdir(): Permission denied
If you see the above error, that means you are having problem creating a directory. Since your server apache or nginx does not have the permission to create a directory, the move() function can not create and move a file.
In general the permission issue happens if you change server or upload your project to a completely new server.
There are a few ways to grant your apache or nginx server to create file permission. Here's how I did it.
sudo chown -R www-data /folder
Here www-data for Ubunto
sudo chown -R apache /folder
for Linux server
-R means recursively. So in general if you want to create a file inside uploads folder, then it would like below
sudo chown -R www-data /var/www/html/example.com/public/uploads
sudo chown -R apache /var/www/html/example.com/public/uploads
Folder path could be anyone for you.
There's another approach that could work as well
Last approach for changing the file creating permission is to let SELinux do it for you. But you need to assign permission to it.
chcon -R -t httpd_sys_content_t /path/to/www chcon -R -t httpd_sys_content_rw_t /path/to/www/dir/for/rw