title: Upload a file with App Inventor 2 to a server through PHP
body: <p>I am trying to upload a file with App Inventor 2 to a server through PHP. I followed the <a href="https://amerkashi.wordpress.com/2014/02/27/how-to-develop-a-photo-boot-android-app/" rel="nofollow noreferrer">Photo Booth Android app</a> tutorial, however server-side, myPhoto.jpg contains the filename, not the picture's content (e.g. myPhoto.jpg contains something like "file:///storage/emulated/0/Pictures/app_inventor_1424997354199.jpg"). How can I fix it?</p>
  
  <p>The code I use:</p>
  
  <p><img src="https://i.stack.imgur.com/GK8X8.png" alt="enter image description here"></p>
  
  <p>tempSaveFile.php :</p>
  
  <pre><code>&lt;?php
   
  $dataToWrite = $_REQUEST['fileName'];
  $fileName = "myPhoto.jpg";     
  file_put_contents($fileName, $dataToWrite);
   
  ?&gt;
  </code></pre>
  
  <p>I am aware of <a href="https://puravidaapps.com/postfile.php" rel="nofollow noreferrer">Taifun's tutorial</a> but since in my php.ini <code>always_populate_raw_post_data = On</code> I would prefer to avoid having to install anything.</p>
  
  <p><a href="https://groups.google.com/d/msg/app-inventor-developers-library/Sc4a1wZHL-Q/OxTndqsHUxQJ" rel="nofollow noreferrer">Scott's tutorial</a> seems to do something similar (with App Inventor 1):</p>
  
  <p><img src="https://i.stack.imgur.com/UW8x4.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/BstTu.png" alt="enter image description here"></p>