php上传文件出错
请大神帮个忙看看哪错了<?phpif(@is_uploaded_file($_FILES['upfile']['tmp_name'])){$f=$_FILES["upfi...
请大神帮个忙看看哪错了
<?php
if (@is_uploaded_file($_FILES['upfile']['tmp_name'])){
$f = $_FILES["upfile"];
print_r($f);
$name = $f['name'];
$type = $f['type'];
$error = $f['error'];
$tmp = $f['tmp_name'];
$size = $f['size'];
if($error==0){
move_uploaded_file($tmp,'/up',$name);
echo '上传成功!';
}
}
?>
<form enctype="multipart/form" method="post" name="up" action="">
<input name="upfile" type="file"/>
<input type='submit' />
</form> 展开
<?php
if (@is_uploaded_file($_FILES['upfile']['tmp_name'])){
$f = $_FILES["upfile"];
print_r($f);
$name = $f['name'];
$type = $f['type'];
$error = $f['error'];
$tmp = $f['tmp_name'];
$size = $f['size'];
if($error==0){
move_uploaded_file($tmp,'/up',$name);
echo '上传成功!';
}
}
?>
<form enctype="multipart/form" method="post" name="up" action="">
<input name="upfile" type="file"/>
<input type='submit' />
</form> 展开
展开全部
<?php
if (@is_uploaded_file($_FILES['upfile']['tmp_name'])){
$f = $_FILES["upfile"];
print_r($f);
$name = $f['name'];
$type = $f['type'];
$error = $f['error'];
$tmp = $f['tmp_name'];
$size = $f['size'];
if($error==0){
move_uploaded_file($tmp,"./up/$name");
echo '上传成功!';
}
}
?>
<form enctype="multipart/form-data" method="post" name="up" action="">
<input name="upfile" type="file"/>
<input type='submit' />
</form>
你有两处小错误,第一上传表单参数应该是enctype="multipart/form-data",第二PHP的move_uploaded_file函数有两个参数,不是三个!
或许是因为你想写成'/up'.$name,但由于粗心句号写成了逗号。如果你想着PHP里的逗号和点是一样都是连接符的话,那么在函数参数中不一样。
谢谢
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询