I would really like your help. I would consider myself an intermediate PHP programmer, but I have never used file uploads before. I have been stuck on this problem for a long time. This is a simplified version of my code and I'm 99% sure the error lies somewhere in here. The output is always "The file wasn't an image file."
This is my HTML...
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" id ="partyPic"><br/>
<button type="button" onClick="uploadFile()">upload</button>
</form>
This is my PHP...
$image = $_FILES['image']['tmp_name'];
if (!isset($image)){
//Create default image.
}else{
$image = mysql_real_escape_string(file_get_contents($_FILES['image']['tmp_name']));
$name = mysql_real_escape_string($_FILES['image']['name']);
$image_size = getimagesize($_FILES['image']['tmp_name']);
}
if($image_size == FALSE){
echo 'The file wasn\'t an image file.';
}else{
//I have code that successfully uploads stuff to my database.
}
If you could help it would be greatly appreciated.
Thank you, Rick Ryan