I have written some code to process an image upload from a web form. The name given to the image upload field is 'img'.
if(isset($_POST["img"])) {
$file_size=$_FILES['img']['size'];
$file_name=$_FILES['img']['name'];
$file_type=$_FILES['img']['type'];
$file_image=$_FILES['img']['tmp_name'];
if($file_type =="image/jpeg") {
$insert_img = mysql_query("INSERT INTO image(image_id,image_name,image_type,image,image_size) VALUES(null,'$file_name','$file_type','$file_image','$file_size')");
}
}
I've tested it a number of times within my website, but each, and every, time I run the script it just doesn't work. I'm at a loss to as to where I'm going wrong!
Any help would be grately appreciated. Thank you in advance. 🙂