<?php include('../include/config.php');
if(empty($_SESSION['sus']) && empty($_SESSION['spa']))
{
echo "<script>window.location='index.php'</script>";
}
/*##########################################*/
$id=$_GET['id'];
if(isset($_POST['save']))
{
define ("MAX_SIZE","1000");
function getExtension($str)
{
$i = strrpos($str,".");
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
$errors=0;
$image=$_FILES['image']['name'];
if ($image)
{
$filename = stripslashes($_FILES['image']['name']);
$extension = getExtension($filename);
$extension = strtolower($extension);
if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")
&& ($extension != "gif")&& ($extension != "JPG") && ($extension != "JPEG")
&& ($extension != "PNG") && ($extension != "GIF"))
{
echo '<h3>Unknown extension!</h3>';
$errors=1;
}
else
{
$size=filesize($_FILES['image']['tmp_name']);
if ($size > MAX_SIZE*1024)
{
echo '<h4>You have exceeded the size limit!</h4>';
$errors=1;
}
$image_name=time().'.'.$extension;
$newname="img/".$image_name;
$copied = copy($_FILES['image']['tmp_name'], $newname);
if (!$copied)
{
echo '<h3>Copy unsuccessfull!</h3>';
$errors=1;
}
else //echo '<h3>uploaded successfull!</h3>';
$title=$_POST['title'];
$content=$_POST['content'];
$sql="update home set title='$title',content='$content',img='$newname' where id='$id'";
$res=mysql_query($sql);
if($res)
{
echo "<script>alert('You have successfully Uploaded')</script>";
echo "<script>window.location='admin_home.php'</script>";
}
else{
echo "failed submit";
echo "<script>window.location='admin_home.php'</script>";
}
}
}
}
?>
actully我更新本地主机上的代码它正在更新但在线服务器它没有更新如何更新代码
实际上我更新了它正在更新的本地主机上的代码但是在在线服务器中它没有更新如何更新代码 实际上我更新了它正在更新的本地主机上的代码,但在在线服务器中它没有更新如何更新代码
答案 0 :(得分:1)
你得到什么错误代码?
echo $_FILES['image']['error']
0 => 'There is no error, the file uploaded with success'
1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini'
2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'
3 => 'The uploaded file was only partially uploaded'
4 => 'No file was uploaded'
6 => 'Missing a temporary folder'
7 => 'Failed to write file to disk.'
8 => 'A PHP extension stopped the file upload.'