title: php fopen dynamic file path
body: <p>I am trying to make simple script that would allow user to upload image to my database. I have problem with php fopen function.</p>
  
  <p>I need to allow user upload any image file on his computer so path to the file is different every time. </p>
  
  <pre><code>&lt;form method="POST"&gt;
          &lt;input type="file" name="img"&gt;
          &lt;input type="submit" value="uload"&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>This simple form is returning only string value of file and i need to open the file using fopen function that needs direct path to the file.</p>
  
  <pre><code>fopen($_POST["img"],"r");
  </code></pre>
  
  <p>This works only if file is in the same directory as php script.</p>
  
  <p>So I am asking if there is a way how to find where the file is stored so i could open it using fopen function.</p>