I've got the following code that uploads an image as well as inputs information from a form into a database:
$result = mysql_query("SELECT id FROM music_bands ORDER BY id DESC LIMIT 0,1");
$row = mysql_fetch_array($result);
$ID2 = $row['id'] + 1;
$ID3 = ($ID2.".jpg");
$newpic = "/home/user/public_html/music/bands/pictures/".$ID2.".jpg";
if(is_uploaded_file($_FILES['userFile']['tmp_name'])) {
if(move_uploaded_file($_FILES['userFile']['tmp_name'], $newpic))
{
$sql = "INSERT INTO music_bands
(bandName,city,state,bio,member1,member2,member3,member4,member5,member6,member7,member8,website,misc,contact,pic,shortName)
VALUES ('$bandName','$city','$state','$bio','$member1','$member2','$member3','$member4','$member5','$memeber6','$member7','$member8','$website','$misc','$contact','$ID3','$name')";
if (mysql_query($sql)) {
header("Location: submit-your-band.php?s=t");
}
else {
echo("<p>Error adding submitted band: " . mysql_error() . "</p>");
}
}
}
But for some reason it seems to be stopping at:
if(is_uploaded_file($_FILES['userFile']['tmp_name'])) {
I've used this exact same piece of code for other upload scripts and it has worked fine. I've got the permissions of the folder set to 777.