-1
我想从HTML表单上传图像,但它不会将其上传到我的文件夹。move_uploaded_file不起作用
这里是我的代码:
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="image">
</form>
$post_image= $_FILES['image']['name'];
$image_tmp= $_FILES['image']['tmp_name'];
$location = $_SERVER['DOCUMENT_ROOT'] . "/images/".$post_image;
move_uploaded_file($image_tmp,$location);
这是文件夹结构:
root
images ----> destination for upload
includes
admin ----> i am working here
我也尝试使用类似这样的路径,但它也不能工作。
$location = "../../images".$post_image;
您是否具有对'images'文件夹的写入权限?或者说,您的网络服务器的用户是否具有写入权限? – Lix
我希望你把''标签放在你的php代码中:) – 2014-02-23 15:21:53
检查这一个http://stackoverflow.com/questions/5655859/move-uploaded-file-doesnt-work-no-error –