title: Python file upload to php Script
body: <p>I'm currently trying to upload a file using a python script to a php server. </p>
  
  <p>Unfortunately I always get an Error: </p>
  
  <p>Python Code: </p>
  
  <pre><code>import requests,json
  URL = '&lt;Serverurl&gt;.php'
  myfile = '&lt;uploaddir&gt;\Bild.jpg'
  
  files = {'upfile' : open(myfile, 'rb')}
  r = requests.post(URL, files = files)
  
  print(r.text) 
  </code></pre>
  
  <p>PHP Code:  </p>
  
  <pre><code>if (!empty($_FILES["upfile"])) {     
              $imageFile = fopen($_FILES["upfile"]["tmp_name"], "r") or die("Unable to open file!");
              $imageData = fread($imageFile, $_FILES["upfile"]["size"]);
              fclose($imageFile);
              //image processing follows here .. 
  } else {
      echo "Error: no image found";
  }  
  </code></pre>
  
  <p>Error I receive from my python console: 
  <code>"Unable to open file!</code>"  </p>
  
  <p>Php-Console Error: </p>
  
  <pre><code>'PHP message: PHP Warning:  fopen(): Filename cannot be empty in /home/vcap/app/htdocs/index.php on line 18\n'
  </code></pre>
  
  <p>I hope someone has an idea to solve this problem. 
  Greetings </p>