title: PHP File Upload to Database
body: <pre><code>&lt;body&gt;
  &lt;form action="#" enctype="multipart/form-data" method="post"&gt;
  &lt;input multiple="" name="img[]" type="file" /&gt;
  &lt;input name="submit" type="submit" /&gt;
  &lt;/form&gt;
  &lt;?php
      mmysql_connect("localhost","root","");
      mysql_select_db("multiple");
      if(isset($_POST['submit'])){
          $filename = $_FILES['img']['name']);
          $tmpname = $_FILES['img']['tmp_name']
          $filetype = $_FILES['img']['type'];
          for($i=0; $i&lt;=count($tmpname)-1; $i++){
              $name =addslashes(filename[$i]);
              $tmp = addslashes(file_get_contents($tmpname[$i]));
              mysql_query("INSERT into img(name,image) values('$name','$tmp')");
              echo "uploaded";
          }
      }
  ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I am trying to upload a simple image to my database So I can work on this user hosted site. So far nothing has worked. I'm dyin here. I've looked through so many tutorials.</p>