title: Need php code to store file uploaded with wget
body: <p>I need to upload file on server from command line. I do next:</p>
  
  <pre class="lang-bash prettyprint-override"><code>wget -d --post-file=links.txt http://bearnova.com/upload_file.php
  </code></pre>
  
  <p>Here is upload_file.php . Code below doesn't work of course:</p>
  
  <pre><code>&lt;?php
  if ($_FILES["file"]["error"] &gt; 0) {
    echo "Error: " . $_FILES["file"]["error"] . "&lt;br&gt;";
  } else {
    echo "Upload: " . $_FILES["file"]["name"] . "&lt;br&gt;";
    echo "Type: " . $_FILES["file"]["type"] . "&lt;br&gt;";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB&lt;br&gt;";
    echo "Stored in: " . $_FILES["file"]["tmp_name"];
  
    move_uploaded_file($_FILES["file"]["tmp_name"],
    "upload/" . $_FILES["file"]["name"]);
    echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
  
  }
  ?&gt;
  </code></pre>
  
  <p>Wget does an HTTP POST to send file.
  I've also heard about $_POST, $HTTP_RAW_POST_DATA and file_get_contents(php://input)
  I'm not a php guy at all. So could someone please help me to get a valid solution?
  Thanks.</p>