I was trying to upload an image to a php server and from there send the image to parse.com using this documentation : https://parse.com/docs/rest#files
but the in parse , I can see only 0 sized images. I am thinking that the problem is with file permission
so I tried to change the file permission.
$target_path = "uploads/";
$img =rand().basename( $_FILES['image']['name']);
$target_path=dirname(__FILE__)."/".$target_path.$img;
print($target_path);
chmod($target_path,0777);
but while executing this I am getting the following warning
Warning: chmod(): No such file or directory in /var/www/test/new.php on line 15
I can see the file in the uploads folder. and the owner of the file is www-data. any pointers
PS: Instead of absolute path I tried using relative paths also.
You are targeting the script file and not the PATH by doing 'FILE'.
Use 'DIR' and verify if the folder exist is_dir() before attempting permission verification.
$target_path = "uploads/";
$img =rand().basename( $_FILES['image']['name']);
$target_path=dirname(__DIR__)."/".$target_path.$img;
print($target_path);
chmod($target_path,0777);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With