php上传文件
我得到了一切,但这个工作正常。我无法让 move_uploaded_file();
工作。
$ups_path = "ups/files";
$nfile = $_FILES['nfile']['tmp_name'];
$cfile = move_uploaded_file($nfile, $ups_path);
if($cfile){
header ('Location: index.php?give=fileuploaded');
} else {
header ('Location: index.php?give=filenotuploaded');
}
它总是返回不移动它的错误。
I got EVERYTHING, but this working. I can't get the move_uploaded_file();
to work.
$ups_path = "ups/files";
$nfile = $_FILES['nfile']['tmp_name'];
$cfile = move_uploaded_file($nfile, $ups_path);
if($cfile){
header ('Location: index.php?give=fileuploaded');
} else {
header ('Location: index.php?give=filenotuploaded');
}
It always returns the error for not moving it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果 ups/files 目录那么这将失败。 move_uploaded_file 期望第二个参数是文件名,而不是目录。
If ups/files a directory then this will fail. move_uploaded_file expects the second argument to be a filename, not a directory.
尝试使用绝对路径而不是相对路径:
Try using the absolute path instead of relative one: