title: How to upload mp3 files
body: <p>Im trying to get a form to upload mp3 or certain image files to a folder.<br>
  Using below code I can upload the image files ok, but when i try to upload an mp3 i get the error <code>Undefined index: file in C:\wamp\www\recordlabel\inc\soundclips.php on line 6</code> and the code echos <code>invalid file</code> from my else block. can anyone offer assistance?</p>
  
  <pre><code> $allowedExts = array("mp3", "jpeg", "jpg", "png");
   $temp = explode(".", $_FILES["file"]["name"]);
   $extension = end($temp);
  
   if ((($_FILES["file"]["type"] == "audio/mp3")
          || ($_FILES["file"]["type"] == "image/jpeg")
          || ($_FILES["file"]["type"] == "image/jpg")
          || ($_FILES["file"]["type"] == "image/pjpeg")
          || ($_FILES["file"]["type"] == "image/x-png")
          || ($_FILES["file"]["type"] == "image/png"))
          &amp;&amp; in_array($extension, $allowedExts))
  {
     if ($_FILES["file"]["error"] &gt; 0)
     {
        echo "Return Code: " . $_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 "Temp file: " . $_FILES["file"]["tmp_name"] . "&lt;br&gt;";
  
        if (file_exists("../soundclips/" . $_FILES["file"]["name"]))
        {
           echo $_FILES["file"]["name"] . " already exists. ";
        }
        else
        {
           move_uploaded_file($_FILES["file"]["tmp_name"],
           "../soundclips/" . $_FILES["file"]["name"]);
           echo "Stored in: " . "../soundclips/" . $_FILES["file"]["name"];
        }
     }
  }
  else
  {
      echo "Invalid file";
  }
  </code></pre>
  
  <p>And this is my form</p>
  
  <pre><code>&lt;form class='form1' action='../inc/soundclips.php' method='post'     
                                                     enctype='multipart/form-data'&gt;
     &lt;input type="hidden" name="id" value="&lt;?php echo $pid; ?&gt;"/&gt;
     &lt;b&gt;Add Soundclip For &lt;i&gt;&lt;?php echo $e;?&gt;&lt;/i&gt; &lt;/b&gt; 
     &lt;?php echo"&lt;divclass='editimage'&gt;";
     echo "&lt;img class='resizedimage' src='{$row['image']}' /&gt;";
     echo"&lt;/div&gt;";?&gt;&lt;br /&gt; 
     &lt;b&gt;Song&lt;/b&gt;&lt;br /&gt;&lt;input type=text size='60' name='asong' /&gt;&lt;br /&gt;
     &lt;input name='file' type="file" id="file"  /&gt;&lt;br /&gt;
     &lt;input type='submit' name='add' value='Add Soundclip' /&gt;
  &lt;/form&gt;
  </code></pre>