I am using Dreamweaver CS3. I used their update form feature and have tried altering it a bit. The upload file works, but I keep getting an error that says "Warning: Cannot modify header information - headers already sent by (output started at /home/content/e/v/e/everyscene/html/admin/addbarext.php:59) in /home/content/e/v/e/everyscene/html/admin/addbarext.php on line 76". In my research, I found that there cannot be an output before the header. If I switch them places, the file does not upload. Is there something I am missing or a better way to do this? Thank you
Code:if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "addpic")) { $target = "../includes/barpics/"; $target = $target . basename( $_FILES['barpicext']['name']) ; $ok=1; if ($uploaded_size > 1073741824) { echo "Your picture file is too large.<br>"; $ok=0; } if ($ok==0) { echo "Sorry your picture file was not uploaded"; } else { if(move_uploaded_file($_FILES['barpicext']['tmp_name'], $target)) { echo "The file " . basename( $_FILES['barpicext']['name']) . " has been uploaded"; } else { echo "Sorry, there was a problem uploading your picture file."; } } $updateSQL = sprintf("UPDATE bars SET barpicext=%s WHERE barID=%s", GetSQLValueString($_FILES['barpicext']['name'], "text"), GetSQLValueString($_POST['barID'], "int")); mysql_select_db($database_everyscene, $everyscene); $Result1 = mysql_query($updateSQL, $everyscene) or die(mysql_error()); $updateGoTo = "viewbars.php"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: ", $updateGoTo)); }



Reply With Quote

Bookmarks