Ok. So you're saying something is assigning it the wrong MIME type? I can't see it in my script 🙁
but then, this is something I don't think I've come across befere. Can you help, please?
Here's the script:
<?php
// add a file
$page_title='Upload a File';
include('includes/header.html'); // page top
if(isset($_POST['submit'])){
require_once('mysql_connect.php');
function escape_data($data){
global $dbc;
if(ini_get('magic_quotes_gpc')){
$data= stripslashes($data);
}
return mysql_real_escape_string(trim($data), $dbc);
} // end of function
if(!empty($_POST['description'])){ // if description present, tidy it up
$d = escape_data($_POST['description']);
} else {
$d = ''; // if no description assign blank value
}
// add the record to the database
$query = "INSERT INTO uploads (file_name, file_size, file_type, description, upload_date)VALUES ('{$_FILES['upload']['name']}',{$_FILES['upload']['size']},'{$_FILES['upload']['type']}','$d', NOW())";
$result= @mysql_query($query);
if($result){ // create new filename
$extension = explode('.',$_FILES['upload']['name']);
$uid = mysql_insert_id(); // upload id
$filename = $uid . '.' . $extension[1];
if(move_uploaded_file($_FILES['upload']['tmp_name'], "../../uploads/$filename")){
echo '<p>The file has been uploaded!</p>';
}else{
echo '<p><font color="red">The file could not be moved</font></p>';
$query = "DELETE FROM uploads WHERE upload_id = $uid";
$result = @mysql_query($query);
}
}else{
echo '<p><font color="red">Your submission could not be processed due to a system error. We apologise for any incovenience.</font></p>';
}
mysql_close();
}
?>
<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="524288">
<fieldset><legend>Fill out the form to upload a file:</legend>
<p><b>File:</b><input type="file" name="upload" /></p>
<p><b>Description:</b><textarea name = "description" cols="40" rows="5"></textarea></p></fieldset>
<div align="center"><input type="submit" name="submit" value="submit" /></div>
</form>
<?php
include('includes/footer.html');