PHP move_uploaded_file() 错误? [英] PHP move_uploaded_file() error?

查看:36
本文介绍了PHP move_uploaded_file() 错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码,它在我的本地机器上成功上传文件.它在我的本地机器上显示成功上传".

I using following code and it is successfully uploading files on my local machine. It is showing "Successfully uploaded" on my local machine.

// Upload file
$moved = move_uploaded_file($_FILES["file"]["tmp_name"], "images/" . "myFile.txt" );

if( $moved ) {
  echo "Successfully uploaded";         
} else {
  echo "Not uploaded";
}

但是当我在我的在线服务器上使用此代码时,它不会上传文件,只会显示消息未上传".

But when I used this code on my online server then it is not uploading file and just showing message "Not uploaded".

我如何知道问题出在哪里以及如何将实际问题显示给用户?

How can I know that what is the problem and how can I get the actual problem to display to the user ?

推荐答案

检查网络服务器是否有权限写入images/"目录

Check that the web server has permissions to write to the "images/" directory

这篇关于PHP move_uploaded_file() 错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆