title: Writing in file on web server using php
body: <p>I have an android app that should upload photo to web server using php and POST connection, I receive the photo String correctly but my problem is with saving it in the server.</p>
  
  <p>the php file I am connecting on it is in the below location:</p>
  
  <pre><code>www.mysite.com/project/code.php.
  </code></pre>
  
  <p>PHP is enabled on my website, and I enabled fopen command</p>
  
  <p>I also tried to open any file and write anything in it but I fail (Echo doesn't executed and no file is saved). what is the problem? should I have special permissions to be able to create files?</p>
  
  <p>Code:</p>
  
  <pre><code>?php
  // Get image string posted from Android App
  $base=$_REQUEST['image'];
  // Get file name posted from Android App
  $filename = $_REQUEST['filename'];
  // Decode Image
  $binary=base64_decode($base);
  header('Content-Type: bitmap; charset=utf-8');
  $file = fopen('uploadedimages/'.$filename, 'wb');
  // Create File
  fwrite($file, $binary);
  fclose($file);
  echo 'Image upload complete, Please check your php file directory';
  ?&gt;
  </code></pre>