从tmp移动到位置时出错...这是我的代码
#circle2 { width: 100px; height: 100px;
position: relative;
background: white;
margin: 0 auto;
border-radius: 50%;
z-index: 2;}
#circle { width: 100px; height: 100px;
position: relative;
background: gray; opacity: .6;
margin: 0 auto;
border-radius: 50%;
z-index: 3;}
#line { display: block; position: relative;
width: 100%; height: 5px;
background: red; top: -50px;
z-index: 1;}
我哪里出错了......是的,有一个文件夹'uploads'
答案 0 :(得分:2)
我哪里出错了......是的,有一个文件夹'uploads'
密钥tmp
不存在,正确的是tmp_name
,也是
确保文件夹uploads
可写。
if(isset($_POST['upload']))
{
$name = $_POST['name'];
$album_id = $_POST['album'];
$file = $_FILES['file']['name'];
$file_type = $_FILES['file']['type'];
$file_size = $_FILES['file']['size'];
$file_tmp = $_FILES['file']['tmp_name']; //The error is here
$random_name = rand();
if(empty($name) || empty($file))
{
echo "Please fill all the fields";
}
else
{
move_uploaded_file($file_tmp, 'uploads/'.$random_name.'.jpg');//Error in this line
mysqli_query($con,"INSERT INTO `p_photos` (`name`,`album_id`,`url`) VALUES ('$name','$album_id','$random_name.jpg')");
echo 'Photo Uploaded successfully!<br /><br />';
}
}
详细了解php file uploads
答案 1 :(得分:1)
您要查找的属性是tmp_name,而不是tmp