<?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在运行时不会出错。
答案 0 :(得分:3)
将$fileTempName = $_FILES['temp_name'];
转换为
$fileTempName = $_FILES['that_input_name']['tmp_name'];