PHP form not uploading file

seeker

New Member
I have a PHP form that is inserting information into a database. It all works except for the file upload. The filename needs to get placed inside the "image" column in the database table and the file needs to be put in the directory as well. Funny thing is that this uploader was working yesterday. :-SPlease can someone just review my PHP code and see if i am missing something?? Thanks so much!!FORM CODE:\[code\]<form name="upload_announcement" method="post" action="PostAnnouncement.php">Title: (limit 35 characters)<br /><input type="text" name="title" maxlength="32" style="width:200px;" /><br /><br />Message: (limit 500 html characters)<br /><textarea name="message" cols="60" rows="20"></textarea><br /><br />Upload Image: (Specs: .jpg format, 255px X 255px, and less than 500kb in size.)<br /><input type="file" name="image" id="image" style="color:#fff;" /><br /><br />Start Date:<br /><input name="dateStart" type="text" id="dateStartImg" /><br /><br />End Date:<br /><input name="dateEnd" type="text" id="dateEndImg" /><br /><br /><input type="hidden" name="customerId" value="http://stackoverflow.com/questions/3553492/<?php echo $_COOKIE['customerId']; ?>" /><input type="submit" name="upload" value="http://stackoverflow.com/questions/3553492/Upload Announcement" /></form>`SUBMIT CODE:<br />`include('ConfigRead.php');$customerId = $_COOKIE['customerId'];$select = mysql_query('select filingName from user where customerId = '.$customerId.' limit 1') or die('Error: ' . mysql_error());$selectRow = mysql_fetch_array( $select );$filingName = $selectRow['filingName'];$imageFileName = $_FILES['image']['name'];if((($_FILES["image"]["type"] == "image/gif")|| ($_FILES["image"]["type"] == "image/jpeg")|| ($_FILES["image"]["type"] == "image/pjpeg"))&& ($_FILES["image"]["size"] < 500000)){ if($_FILES["image"]["error"] > 0){ header("location:Announcements.php?file=error"); }else{ move_uploaded_file($_FILES["image"]["tmp_name"], "../Admin/CustomerFiles/Announcements/" . $filingName . "/" . $imageFileName); }}else{ header("location:Announcements.php?file=error");}$sql="INSERT INTO announcements (customerId, filingName, title, message, image, dateStart, dateEnd) VALUES ('$_POST[customerId]','$filingName','$_POST[title]','$_POST[message]','$imageFileName','$_POST[dateStart]','$_POST[dateEnd]')";if (!mysql_query($sql,$connRead)) { die('Error: ' . mysql_error()); }include('CloseConnRead.php');header("location:ManageAnnouncements.php?add=success");`\[/code\]
 
Back
Top