Im trying to upload files to my mysql database using php. All works fine. untill I try to upload a mp3 file. First I though that it was something wrong with the MIME type sent by the browser. that I didnt recognise .mp3 as a type of file. But Ive tried with both IE 6.0 and a new verion of firefox and the result is the same. Im using a form to upload the file to the database. Whenever I try to upload a mp3 file the save script file is shown as empty. I cant understand why. at least one of the to browsers should have support for the mp3 format. So my big question is: what is generating this error? The code of the save_file script:
<?
session_start();
include "../include/absolute_path.php";
// check if file and description have been entered
if(empty($_POST['desc']) || $_FILES['file']['tmp_name'] == "none")
die("You must enter both a description and file");
include absolute_path("include/db_connections/arc_db.php");
$db=@mysql_pconnect($db_HOST,$db_USER,$db_PASS);
@mysql_select_db($db_db) or die("DATABASE ERROR". mysql_error());
$fileHandle = fopen($_FILES['file']['tmp_name'], "r");
$fileContent = fread($fileHandle, $_FILES['file']['size']);
$fileContent = addslashes($fileContent);
//creates the date
$date=date("Y-m-d H:i:s");
$sql = "INSERT INTO ".$_SESSION['name']."(data,title,description,type,size,date) VALUES ('$fileContent', '$title','".$_POST['desc']."','".$_FILES['file']['type']."','".$_FILES['file']['size']."','$date')";
mysql_query($sql) or die("Couldn't add file to database". mysql_error());
echo "<h1>File Uploaded</h1>";
echo "The details of the uploaded file are shown below:<br><br>";
echo "<b>File name:</b> $title <br>";
echo "<b>File type:</b> ".$_FILES['file']['type']." <br>";
echo "<b>File size:</b> ".$_FILES['file']['size']." <br>";
echo "<b>Uploaded to:</b> ".$_FILES['file']['tmp_name']." <br><br>";
?>