【发布时间】:2012-04-12 18:06:35
【问题描述】:
我有一个名为“Mobile_App”的文件夹,该文件夹中有一个 html 页面,其中包含一个文件输入、一个上传文件的 php 脚本和一个名为“ImageFiles”的文件夹。
问题是文件没有被上传到“ImageFiles”。我想知道的是,在将文件上传到“Imagefiles”文件夹时,下面的代码是正确的,还是不正确,我怎样才能让它正常工作?
以下是上传文件的php脚本(文件输入称为“fileImage”):
<?php
$destination_path = $_SERVER['DOCUMENT_ROOT']."/ImageFiles";
$result = 0;
$target_path = $destination_path . basename( $_FILES['fileImage']['name']);
if(move_uploaded_file($_FILES['fileImage']['tmp_name'], $target_path)) {
$result = 1;
}
sleep(1);
?>
【问题讨论】:
-
那么当你运行脚本时会发生什么?
-
当我运行脚本时它只是带有一个空白页
-
你试过
error_reporting()吗? -
我会尝试error_reporting,我不知道为什么上传后文件会进入ImageFiles文件夹,因为我尝试了blake305的答案,但没有文件被上传到ImageFiles文件夹中。已经设置了必要的权限,因为我要求组织服务器的人确保脚本和所有文件夹都设置正确以允许上传和删除文件
标签: php