Código PHP:
Ver original
// ************************************************************ // Add News Article // ************************************************************ if ($action == "addnews") { // Process Add News Submition // Form post variables $poster = $_POST['poster']; $title = $_POST['title']; $sticky = $_POST['sticky']; $snippet = $_POST['snippet']; $article = $_POST['article']; $topic_id = $_POST['topic']; $file = $_POST['file']; $tamano = $_FILES["file"]['size']; $tipo = $_FILES["file"]['type']; $archivo = $_FILES["file"]['name']; $poster = $sn_user; } // Current Time // Add slashes for ' and " // Check for required fields echo " <p class='error'><i>Title</i>, <i>Topic</i>, and <i>Snippet</i> are required fields.</p> <p class='error'><a href='article.php?action=addnews'>Go Back</a></p>"; } else { $news_id = $_GET['edit']; // Check Access if (($sn_userlevel == 1) OR ($sn_userlevel == 2)) { //Remove sticky from other posts $query = "UPDATE simplenews_articles SET sticky = 'off' WHERE sticky = 'on'"; } else { echo " <p class='error'>You don't have access to to create sticky posts.</p> <p class='error'><a href='article.php?action=addnews'>Go Back</a></p>"; } } // Check Access if ((($sn_user == $poster) OR ($sn_userlevel == 1) OR ($sn_userlevel == 2))) { // Update Edited Article $query = "UPDATE simplenews_articles SET poster = '$poster', title = '$title', sticky = '$sticky', snippet = '$snippet', article = '$article', topic = '$topic_id' WHERE news_id = '$news_id'"; echo " <p class='error'>The news article has been updated.</p> <p class='error'><a href='article.php'>Go Back</a></p>"; } else { echo " <p class='error'>You don't have access to edit this post.</p> <p class='error'><a href='article.php'>Go Back</a></p>"; } } else { // obtenemos los datos del archivo $destino = "files/".$prefijo."_".$archivo; //Insert new article $query = "INSERT INTO simplenews_articles (poster, title, sticky, snippet, article, date, topic, imagen) VALUES ('$poster', '$title', '$sticky', '$snippet', '$article', '$timestamp', '$topic_id', '$file')"; echo " <p class='error'>The news article <i>$title</i> been added.</p> <p class='error'><a href='article.php'>Go Back</a></p>"; } }
todo trabaja perfecto pero no se por que no sube la imagen