错误是警告:move_uploaded_file(uploads / cv / 23456543555555CURRICULUM VITAE.doc):无法打开流:C:\ wamp \ www \ job-application \ include \ application.class.php中没有此类文件或目录第121行
警告:move_uploaded_file():无法移动' C:\ wamp \ tmp \ php7EA1.tmp' to'上传/ cv / 23456543555555CURRICULUM VITAE.doc'在第121行的C:\ wamp \ www \ job-application \ include \ application.class.php
代码如下;
$allowedExtsDoc = array("docx", "pdf", "doc");
$temp = explode(".", $_FILES["file"]["name"]);
$extensionDoc = end($temp);
$uploaddircv = 'uploads/cv/';
$uploadfilecv = $uploaddircv . basename($phone.$_FILES['file']['name']);
if (in_array($extensionDoc, $allowedExtsDoc))
{
if ($_FILES["file"]["error"] > 0)
{
$this->error .= $_FILES["file"]["error"] . "<br>";
}
else
{
if (file_exists($uploaddircv . $_FILES["file"]["name"]))
{
$this->error .= $_FILES["file"]["name"] . " already exists. <br/>";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],$uploadfilecv);
$fileloc = $this->sitePath.$uploadfilecv;
}
}
}
else
{
$this->error .= "Invalid file <br/>";
}
答案 0 :(得分:2)
确保目录:C:\wamp\tmp\
和uploads/cv/
存在且可由Apache编写。
之后,尝试使用完整路径上传文件夹。
$uploaddircv = realpath(dirname(__FILE__) . '/../uploads/cv/') . '/';