title: php- chmod(): No such file or directory
body: <p>I was trying to upload an image to a php server and from there send the image to parse.com using this documentation : <a href="https://parse.com/docs/rest#files" rel="noreferrer">https://parse.com/docs/rest#files</a></p>
  
  <p>but the in parse , I can see only 0 sized images.  I am thinking that the problem is with file permission </p>
  
  <p>so I tried to change the file permission. </p>
  
  <pre><code>            $target_path = "uploads/";
              $img =rand().basename( $_FILES['image']['name']);
              $target_path=dirname(__FILE__)."/".$target_path.$img;
              print($target_path);
              chmod($target_path,0777);
  </code></pre>
  
  <p>but while executing this I am getting the following warning </p>
  
  <p><code>Warning: chmod(): No such file or directory in /var/www/test/new.php on line 15</code></p>
  
  <p>I can see the file in the uploads folder. and the owner of the file is www-data. any pointers </p>
  
  <p>PS: Instead of absolute path I tried using relative paths also.</p>