stevehart808 Posted December 11, 2008 Share Posted December 11, 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 <? $uploadDir = 'mp3/'; include ("../includes/database.connect.php"); if(isset($_POST['send'])) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; // get the file extension first $ext = substr(strrchr($fileName, "."), 1); // generate the random file name $randName = md5(rand() * time()); // and now we have the unique file name for the upload file $filePath = $uploadDir . $randName . '.' . $ext; $result = move_uploaded_file($tmpName, $filePath); if (!$result) { echo "Error uploading file"; exit; } if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); $filePath = addslashes($filePath); } $query = "INSERT INTO show_archive (file ) ". "VALUES ('$filePath')"; mysql_query($query) or die('Error, query failed : ' . mysql_error()); echo "<br>File uploaded<br>"; } ?> <form action="" method="post" enctype="multipart/form-data" name="uploadform"> <table width="350" border="0" cellpadding="1" cellspacing="1" class="box"> <tr> <td width="246"><input type="hidden"><input name="userfile" type="file" class="box" id="userfile"> </td> </tr> <td align="center" valign="middle" colspan="2"><input class="button" type="submit" name="send" value="Submit Details" tabindex="80" /> <a href="index.php" class="box_link3">Back to List</a></form></td> </table> </form> Quote Link to comment https://forums.phpfreaks.com/topic/136486-solved-cant-upload-mp3s-with-this-script/ Share on other sites More sharing options...
Adam Posted December 11, 2008 Share Posted December 11, 2008 Try creating a .php file with only the text: <?php phpinfo(); ?> Then looking for the "upload_max_filesize" setting - check that's not lower than the size of your mp3's! A Quote Link to comment https://forums.phpfreaks.com/topic/136486-solved-cant-upload-mp3s-with-this-script/#findComment-712437 Share on other sites More sharing options...
stevehart808 Posted December 11, 2008 Author Share Posted December 11, 2008 My mistake, thanks for the reply.! Quote Link to comment https://forums.phpfreaks.com/topic/136486-solved-cant-upload-mp3s-with-this-script/#findComment-712445 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.