xampp php文件上载错误
我不知道我在php上上传的文件出了什么问题 php代码:xampp php文件上载错误,php,mysql,file-upload,xampp,Php,Mysql,File Upload,Xampp,我不知道我在php上上传的文件出了什么问题 php代码: <?php session_start(); if ($_SESSION['Loggedin']!="Yes") { header('location:index.php'); exit(); } require_once('Connect.php'); //This is the directory where images will be saved $target = "../htdocs/sites/tr
<?php
session_start();
if ($_SESSION['Loggedin']!="Yes") {
header('location:index.php');
exit();
}
require_once('Connect.php');
//This is the directory where images will be saved
$target = "../htdocs/sites/tryouts/newgames/images/main-news/";
$target = $target . basename( $_FILES['photo']['name']);
//This gets all the other information from the form
$author=$_POST['author'];
$title=$_POST['title'];
$pic=($_FILES['photo']['name']);
$bericht=$_POST['bericht'];
//Writes the information to the database
mysqli_query($Connection, "INSERT INTO nieuws (Nieuws_Author,Nieuws_Title,Nieuws_Image,Nieuws_Bericht)
VALUES ('$author', '$title', '$pic', '$bericht')") ;
//Writes the photo to the server
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))
{
//Tells you if its all ok
echo "The file ". basename( $_FILES['photo']['name']). " has been uploaded, and your information has been added to the directory";
}
else {
//Gives and error if its not
echo "Sorry, there was a problem uploading your file.";
}
?>
如果我们有
//This is the directory where images will be saved
$target = "../htdocs/sites/tryouts/newgames/images/main-news/";
错误呢
警告:移动上传的文件():无法移动
'C:\Users\xammp\tmp\php24D.tmp'到
”../htdocs/sites/tryouts/newgames/images/main news/bandicam2014-05-29
19-48-59-499.jpg'in
C:\Users\xammp\htdocs\sites\tryouts\newgames\addnewscripts.php on
第26行抱歉,上载文件时出现问题
我想说的是,你需要改变你的道路
$target = "C:\Users\xammp\htdocs\sites\tryout\newgames\images\main-news\";
Windows路径与Unix路径混合在一起。这是否是Windows环境?是Windows 7 64位