<?
if($_FILES['file']['name'] != ""){
//upload the image with what ever you want
//move_uploaded_file($_FILES['file']['tmp_name'],$target.$image );
//the SQL query should contain the updating the image column
if(($_GET['mod']=='edit') && (isset($_POST['hidden'])))
{
echo $_FILES["file"]["name"];
$allowedExts = array("jpg", "jpeg", "gif", "png");
$extension = end(explode(".", $images));
if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/png") || ($_FILES["file"]["type"] == "image/pjpeg")) && in_array($extension, $allowedExts)){
if ($_FILES["file"]["error"] > 0){
echo $_FILES["file"]["error"] . "<br>";
}
else{
move_uploaded_file($_FILES["file"]["tmp_name"], "upload-images/" . $images);
$update="UPDATE headline SET headline_title = '$title',headline_des = '$description',month= '$month_name', day= '$day_name', images = '$images' where id = ".$_GET['id']."";
$result = mysql_query($update);
}
}
}
else
{
//SQL update without image
$update="UPDATE headline SET headline_title = '$title', headline_des = '$description', headline = '$headline' WHERE id = ".$_GET['id']."";
$result = mysql_query($update);
}
if($_FILES['file']['name'] != ""){
//upload the image with what ever you want
//move_uploaded_file($_FILES['file']['tmp_name'],$target.$image );
//the SQL query should contain the updating the image column
if(($_GET['mod']=='edit') && (isset($_POST['hidden'])))
{
echo $_FILES["file"]["name"];
$allowedExts = array("jpg", "jpeg", "gif", "png");
$extension = end(explode(".", $images));
if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/png") || ($_FILES["file"]["type"] == "image/pjpeg")) && in_array($extension, $allowedExts)){
if ($_FILES["file"]["error"] > 0){
echo $_FILES["file"]["error"] . "<br>";
}
else{
move_uploaded_file($_FILES["file"]["tmp_name"], "upload-images/" . $images);
$update="UPDATE headline SET headline_title = '$title',headline_des = '$description',month= '$month_name', day= '$day_name', images = '$images' where id = ".$_GET['id']."";
$result = mysql_query($update);
}
}
}
else
{
//SQL update without image
$update="UPDATE headline SET headline_title = '$title', headline_des = '$description', headline = '$headline' WHERE id = ".$_GET['id']."";
$result = mysql_query($update);
}
No comments:
Post a Comment