Hi everyone
I'm trying to create a PHP/MySQL script which will allow a user to enter some details about an image (.jpg or .gif or whatever) and upload it to a MySQL Table.
Now, I've got it working perfectly in Firefox 3.6.8 and in the script portion below, it outputs $msg as "Data successfully uploaded", which is correct.
But when I run the same script with Internet Explorer 8.0.6001.18702 (?) then it outputs $msg as "Error: Not a valid image".
This is the fairly simple bit of code producing these messages. There must be something in it that IE8 doesn't like?
// if Submit button is clicked
if($_POST['Submit']) {
// check for the image type , before uploading
if (in_array($fileType, $image_array)) {
// check whether the file is uploaded
if(is_uploaded_file($_FILES['userfile']['tmp_name'])) {
// check whether the file size is below 1 mb
if($_FILES['userfile']['size'] < $maxFileSize) {
// Getting Size and Type of image from $_FILES
$imageType = $_FILES['userfile']['type'];
$imageSize = $_FILES['userfile']['size'];
// reading the image data
$imageData = mysql_real_escape_string(file_get_contents($_FILES['userfile']['tmp_name']));
// inserting into the database
$sql = "INSERT INTO image (imageData, imageName, imageWidth, imageHeight, imageType, imageSize) VALUES ('$imageData','$imageName','$imageWidth','$imageHeight','$imageType','$imageSize')";
mysql_query($sql) or die(mysql_error());
$msg = "Data successfully uploaded";
}
else {
$msg = 'Error: File size exceeds the maximum limit';
}
}
}
else {
$msg = 'Error: Not a valid image';
}
}
So if there are any experts out there, I would very much appreciate being pointed in the right direction to solve this problem.
Thanks
Terry