我无法使用PHP文件上传到服务器上传文件。当我们尝试使用相同的PHP文件上传页面在服务器上本地上传时,它已成功加载。但是当我们尝试使用相同的php页面从网络上的其他系统访问并上传相同的文件时,它会在下面显示错误。
include("connect.php");
$fname=$_FILES['uploadfile']['name'];
$sessionUsercode=$_SESSION['sessionUsercode'];
$path="/home/path/to/upload/";
if(substr($fname,0,1)=="a")
{
if(substr($fname,2,3)=="off")
{
$mmsg=ucwords("officers");
$mside="A";
$mcause="O";
}
else
{
$mmsg=ucwords("daily");
$mside="A";
$mcause="D";
}
} else if(substr($fname,0,1)=="l")
{
$mmsg=ucwords("Supplementary");
$mside="A";
$mcause="D";
}
echo "path". $lfname=$path.$fname;
echo $uploadfile=$_FILES['uploadfile']['tmp_name'];
if(!file_exists($uploadfile))
$msg=ucwords("uploaded file doesn't exists!");
else
{
$msize=filesize($uploadfile);
if($msize>0)
{
if(file_exists($lfname))
unlink($lfname);
echo $res=copy($uploadfile,$lfname);
if(!$res)
$msg=ucwords("can't upload/copy said file!");
else
{
$file_size=filesize($uploadfile);
$handle = fopen($uploadfile,"r");
$buffer = fread($handle, filesize($uploadfile));
$buffer = addslashes($buffer);
fclose($handle);
$ent_dt=date("Y-m-d");
$ent_tm=date("H:i:s");
$rs1=mysql_query($sqlchk) or die(mysql_error());
$nmsqlchk=mysql_num_rows($rs1);
}
}
else
$msg=ucwords("uploaded file is empty!");
}
header("Location:message.php?msg=$msg");
答案 0 :(得分:0)
我认为ipblock .u的这个webserver错误可以改变unblockip这个正常工作
答案 1 :(得分:0)
<?php
//include 'db.php';
extract($_POST);
extract($_POST);
if(isset($submit)) {
$fname = $_FILES['image']['name'];
$file_tmp = $_FILES['image']['tmp_name'];
$file_size = $_FILES['image']['size'];
$file_type=$_FILES['image']['type'];
$target = "img/".$fname;
move_uploaded_file($file_tmp,$target);
echo "uploaded succ !"."<br>";
}