Cant upload mp3's with this script?

Thread Solved

Join Date: Nov 2008
Posts: 20
Reputation: stevehart808 is an unknown quantity at this point 
Solved Threads: 0
stevehart808 stevehart808 is offline Offline
Newbie Poster

Cant upload mp3's with this script?

 
0
  #1
Dec 11th, 2008
Hi,

This script works great when uploading photos but if I try mp3's I get 'Error uploading file'

Any ideas would be much appreciated!

Thanks

  1.  
  2. <?
  3. $uploadDir = 'mp3/';
  4. include ("../includes/database.connect.php");
  5. if(isset($_POST['send']))
  6. {
  7. $fileName = $_FILES['userfile']['name'];
  8. $tmpName = $_FILES['userfile']['tmp_name'];
  9. $fileSize = $_FILES['userfile']['size'];
  10. $fileType = $_FILES['userfile']['type'];
  11.  
  12. // get the file extension first
  13. $ext = substr(strrchr($fileName, "."), 1);
  14.  
  15. // generate the random file name
  16. $randName = md5(rand() * time());
  17.  
  18. // and now we have the unique file name for the upload file
  19. $filePath = $uploadDir . $randName . '.' . $ext;
  20.  
  21. $result = move_uploaded_file($tmpName, $filePath);
  22. if (!$result) {
  23. echo "Error uploading file";
  24. exit;
  25. }
  26.  
  27. if(!get_magic_quotes_gpc())
  28. {
  29. $fileName = addslashes($fileName);
  30. $filePath = addslashes($filePath);
  31. }
  32. $query = "INSERT INTO show_archive (file ) ".
  33. "VALUES ('$filePath')";
  34.  
  35. mysql_query($query) or die('Error, query failed : ' . mysql_error());
  36. echo "<br>File uploaded<br>";
  37. }
  38. ?>
  39. <form action="" method="post" enctype="multipart/form-data" name="uploadform">
  40. <table width="350" border="0" cellpadding="1" cellspacing="1" class="box">
  41. <tr>
  42. <td width="246"><input type="hidden"><input name="userfile" type="file" class="box" id="userfile">
  43. </td>
  44. </tr>
  45. <td align="center" valign="middle" colspan="2"><input class="button" type="submit" name="send" value="Submit Details" tabindex="80" />&nbsp;&nbsp;<a href="index.php" class="box_link3">Back to List</a></form></td>
  46. </table>
  47. </form>
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 20
Reputation: stevehart808 is an unknown quantity at this point 
Solved Threads: 0
stevehart808 stevehart808 is offline Offline
Newbie Poster

Re: Cant upload mp3's with this script?

 
0
  #2
Dec 11th, 2008
"upload_max_filesize" setting - check that's not lower than the size of your mp3's!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC