1
<?php
error_reporting(E_ALL);
include "func.php";
connectToDatabase("localhost","root","","test");
$fileName = $_FILES['name'];
$fileSize = $_FILES['size'];
$fileType = $_FILES['type'];
$fileTempName = $_FILES['temp_name'];
$uploaderID = $_SESSION['id'];
$date = date("d/m-Y");
$uploadDir = "avatarStor/";
$filePath = $uploadDir . $fileName;

if(!$fileName){
    echo "Error: value 'fileName' was undefined<br>";
}

$result = move_uploaded_file($fileTempName, $filePath);
if (!$result) {
    echo "Error: File could not be uploadet: ".$fileName;
    exit;
}

if(!get_magic_quotes_gpc()){
$fileName = addslashes($fileName);
$filePath = addslashes($filePath);
}

$result = mysql_query("UPDATE users SET profilepicture='$fileName' WHERE id='$uploaderID'") or die(mysql_error());

?>

我无法move_uploaded_file();在此上传脚本中。我继续和chmod 777文件夹,但是,它失败了。PHP 在运行时不提供错误。 结果

4

1 回答 1

3

更改
$fileTempName = $_FILES['temp_name'];

$fileTempName = $_FILES['that_input_name']['tmp_name'];

于 2012-06-14T19:07:01.203 回答