title: PHP File Uploading Issue
body: <p>I'm currently developing a website where users can upload their music. You can set various genres to display. Now, the problem is that sometimes (no idea why) the upload fails for certain files. An error doesnt get displayed. It's definitely not a permission error, since the uploading works for most files.
  I've looked around a lot here already and tried many things, but nothing worked for me.
  Here's my code: </p>
  
  <p>HTML</p>
  
  <pre><code>&lt;form method="post" action="musicupload.php" enctype="multipart/form-data"&gt;
      Choose an MP3 or WAV file&lt;file&gt;&lt;/file&gt;
      &lt;br /&gt;&lt;br /&gt;
      &lt;input type="file" name="fileToUpload" id="fileToUpload" required&gt;
      &lt;br /&gt;&lt;br /&gt;
      &lt;fieldset&gt;
          Genre
          &lt;br /&gt;
          &lt;input type="radio" id="db" name="Genre" value="Dubstep" required checked&gt;
          &lt;label for="db"&gt; Dubstep&lt;/label&gt;
          &lt;input type="radio" id="trap" name="Genre" value="Trap" required&gt;
          &lt;label for="trap"&gt; Trap&lt;/label&gt;
          &lt;input type="radio" id="BB" name="Genre" value="Bass Boosted" required&gt;
          &lt;label for="bb"&gt; Bass Boosted&lt;/label&gt;
          &lt;input type="radio" id="other" name="Genre" value="Other" required&gt;
          &lt;label for="other"&gt; Other&lt;/label&gt;
      &lt;/fieldset&gt;
      &lt;br /&gt;
      &lt;input type="submit" value="Upload Song" name="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>PHP</p>
  
  <pre><code>&lt;?php
  /**
   * Created by IntelliJ IDEA.
   * User: Marc
   * Date: 04.12.2017
   * Time: 20:07
   */
  require 'db.php';
  
  $target_dir = "uploadedmusic/";
  $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
  $uploadOk = 1;
  $filename=$_FILES["fileToUpload"]['name'];
  $ext = pathinfo($filename, PATHINFO_EXTENSION);
  $genre = $_POST["Genre"];
  $successfull = false;
  
  if(isset($_POST["submit"])) {
      // Check extensions
      if ($ext != "mp3" &amp;&amp; $ext != "wav") {
          echo "Sorry, only MP3 &amp; WAV files are allowed.";
          $uploadOk = 0;
      }
  
      if ($uploadOk == 0) {
          echo "Sorry, your file was not uploaded.";
          // if everything is ok, try to upload file
      } else {
          if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
              $hash = md5_file("uploadedmusic/".$filename);
              //echo "The file " . basename($_FILES["fileToUpload"]["name"]) . " has been uploaded.";
              $sql = "INSERT INTO `music` (`id`, `filename`, `genre`, `uploaded`, `hash`) VALUES (NULL, '$filename', '$genre', CURRENT_TIMESTAMP, '$hash')";
              $conn-&gt;query($sql);
              $successfull = true;
          } else {
              $successfull = false;
          }
      }
  }
  
  ?&gt;
  
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Upload Music&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div style="text-align: center;"&gt;
       &lt;img src="logo.png"&gt;
  &lt;h1&gt;Please wait...&lt;/h1&gt;
  &lt;p style="font-size: 35px;"&gt;
      &lt;?php
      if ($successfull == true) {
          echo "Successfully uploaded ". basename($_FILES["fileToUpload"]["name"])."! Use the search to find it!";
      }
      else {
          echo "Sorry, there was an error uploading your file. Check for potential invalid characters like () or - in your filename!";
      }
  
  
      ?&gt;
  &lt;/p&gt;
      &lt;a style="font-size: 35px" href="main.php"&gt;Start listening!&lt;/a&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>