title: How to change the upload directory in php?
body: <p>I have uploaded a Image Data from iPhone app.</p>
  
  <p>I decoded the image Data and tried to save the image in the file.</p>
  
  <p>I'm always receiving an error message as </p>
  
  <blockquote>
    <p>file
    href='function.file-put-contents'>function.file-put-contents]:
    failed to open stream: Permission denied in.</p>
  </blockquote>
  
  <pre><code>define('UPLOAD_DIR', '/Applications/XAMPP/xamppfiles/htdocs/mc311');
  $data = base64_decode($Image);
  $file = UPLOAD_DIR . uniqid() . '.png';
  $success = file_put_contents($file, $data);
  print $success ? $file : 'Unable to save the file.';
  $path = $file;
  </code></pre>