Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP form not uploading file
    primarykey
    data
    text
    <p>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. :-S</p> <p>Please can someone just review my PHP code and see if i am missing something?? Thanks so much!!</p> <p>FORM CODE:</p> <pre><code>&lt;form name="upload_announcement" method="post" action="PostAnnouncement.php"&gt; Title: (limit 35 characters)&lt;br /&gt; &lt;input type="text" name="title" maxlength="32" style="width:200px;" /&gt;&lt;br /&gt;&lt;br /&gt; Message: (limit 500 html characters)&lt;br /&gt; &lt;textarea name="message" cols="60" rows="20"&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt; Upload Image: (Specs: .jpg format, 255px X 255px, and less than 500kb in size.)&lt;br /&gt; &lt;input type="file" name="image" id="image" style="color:#fff;" /&gt; &lt;br /&gt;&lt;br /&gt; Start Date:&lt;br /&gt; &lt;input name="dateStart" type="text" id="dateStartImg" /&gt; &lt;br /&gt;&lt;br /&gt; End Date:&lt;br /&gt; &lt;input name="dateEnd" type="text" id="dateEndImg" /&gt; &lt;br /&gt;&lt;br /&gt; &lt;input type="hidden" name="customerId" value="&lt;?php echo $_COOKIE['customerId']; ?&gt;" /&gt; &lt;input type="submit" name="upload" value="Upload Announcement" /&gt; &lt;/form&gt;` SUBMIT CODE:&lt;br /&gt; `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")) &amp;&amp; ($_FILES["image"]["size"] &lt; 500000)) { if($_FILES["image"]["error"] &gt; 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></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload