title: Image/File upload doesn't work with materializecss framework
body: <p>I want to create a post creator which works with a database, but I can't upload an image or a file. My web-page is using the materialize framework. This code is mostly shrunk down to the important parts.</p>
  
  <pre><code>&lt;?php
  require_once 'include/Database.php';
  require_once 'include/Sessions.php';
  require_once 'include/Functions.php';
  
  if (isset($_POST['addPostButton']) || isset($_FILES['image'])) {
  
      $imageName = $_POST['image'];
      $imageDirectory = 'uploads/' . basename($_FILES['image']['name']);
  
      if (!move_uploaded_file($_FILES['image']['tmp_name'], $imageDirectory)) {
          $_SESSION['ErrorMessage'] = 'File is invalid!';
      } else {
          global $ConnectingDB;
          $stmt = $ConnectingDB-&gt;prepare("INSERT INTO posts(image) VALUES('$imageName')");
          if ($stmt-&gt;execute()) {
              $_SESSION['SuccessMessage'] = 'Post created';
          }
      }
  }
  ?&gt;
  
  &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;Admin Dashboard&lt;/title&gt;
      &lt;link type="text/css" rel="stylesheet" href="css/materialize.css"&gt;
      &lt;link type="text/css" rel="stylesheet" href="css/styles.css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form action="add-post.php" method="post"&gt;
          &lt;div class="row"&gt;
              &lt;div class="file-field input-field"&gt;
                  &lt;div class="btn green"&gt;
                      &lt;span&gt;File&lt;/span&gt;
                      &lt;input type="file" name="image"&gt;
                  &lt;/div&gt;
                  &lt;div class="file-path-wrapper"&gt;
                      &lt;input type="text" class="file-path" placeholder="Choose an image"&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>