Image Upload functionality not working on my droplet

Posted January 10, 2015 5.9k views


Hello Team,

I am facing image upload issue in php on my droplet.
I am trying to upload simple image on specific folder, but image dosen’t move.
When i execute

It retruns true that means upload folder is writable even after that still image not uploaded on that folder

When i execute
$path = ’/var/www/html/StagingServer/project-name/front-design/images/upload/’;

It returns false.
So can you please help on this

Thanks and regards
Ruchit Patel

1 comment
  • Did you also get a warning message when you called move_uploaded_file()? If no message appeared, then most likely your temporary file (or your current working directory) is the problem.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Hello Team
There is no message appeared, so what can I do now. Can you please give me helpful suggestions as soon as possible..

Thanks and regards
Ruchit patel

Hello Team,
Finally, I got the solution of my problem, i will post here which is very useful to others developers

———–Permission to root folder for image upload issue in ubantu14———-

Execute below command
1) ps aux | grep apache
2) groups www-data
3) chown -R www-data:www-data /var/www/
4) chmod -R 775 /var/www/
5) usermod -a -G www-data {YOURUSERNAME}
WARNING! dont forget -a switch! this way you append new group to existing list and not replace old groups list with new one.
Now you have read/write access to files located in apache root dir. And we need to tell apache that new files should be readable/writable to group members
6) echo umask 002 >> /etc/apache2/envvars
7) service apache2 restart

Thanks and regards
Ruchit Patel