在服务器中上传PHP mysql文件

在服务器中上传PHP mysql文件,php,mysql,upload,Php,Mysql,Upload,我正在尝试通过PHP mySQL上传文件。我的脚本在本地主机上运行良好,但在服务器上无法运行。它没有将文件上载到服务器。这是我的动作脚本。 //This is the directory where images will be saved $target1 = "notice/"; $target2 = "notice/"; $target3 = "notice/"; $target4 = "notice/"; $target1 = $target1 . basename( $_F

我正在尝试通过PHP mySQL上传文件。我的脚本在本地主机上运行良好,但在服务器上无法运行。它没有将文件上载到服务器。这是我的动作脚本。
//This is the directory where images will be saved 
$target1 = "notice/";
$target2 = "notice/"; 
$target3 = "notice/"; 
$target4 = "notice/";  

$target1 = $target1 . basename( $_FILES['photo1']['name']); 
$target2 = $target2 . basename( $_FILES['photo2']['name']);
$target3 = $target3 . basename( $_FILES['photo3']['name']);
$target4 = $target4 . basename( $_FILES['photo4']['name']);

 //This gets all the other information from the form 
$day=$_POST['day']; 
$month=$_POST['month']; 
$year=$_POST['year']; 
$title=$_POST['title'];
$dis=$_POST['dis'];
$pic1=($_FILES['photo1']['name']);
$pic2=($_FILES['photo2']['name']); 
$pic3=($_FILES['photo3']['name']); 
$pic4=($_FILES['photo4']['name']);  

// Connects to your Database 
mysql_connect("localhost", "root", "") or die(mysql_error()) ; 
mysql_select_db("trustcol") or die(mysql_error()) ; 

//Writes the information to the database 
mysql_query("INSERT INTO notice VALUES (NULL, '$day', '$month', '$year', '$title',          '$dis', '$pic1', '$pic2', '$pic3', '$pic4')") ; 

move_uploaded_file($_FILES['photo1']['tmp_name'], $target1);
move_uploaded_file($_FILES['photo2']['tmp_name'], $target2);
move_uploaded_file($_FILES['photo3']['tmp_name'], $target3);
move_uploaded_file($_FILES['photo4']['tmp_name'], $target4);
include('adminbanner.php'); 
include('adminmenu2.php');
?>
这在我的PC/localhost上运行得很好,但在服务器上却没有上传文件。为什么

  • 您是否在php.ini(或使用ini\u集)中启用了文件上传

  • 文件大小是否大于php.ini中的配置选项

  • 也看看其他的:PHP.ini

    ,, , ,及

  • 查找上载文件夹的权限


  • 这是否在终端中工作,但不是通过HTML?如果是这样,我也有类似的问题。我一直盯着我的php,但结果发现我的表单html有问题。我忘记将
    enctype=“multipart/form data”
    属性添加到我的
    标记以适应文件上载。

    是否检查了目标文件夹权限?它应该是777。权限、路径、最大上载文件数等。。