我正在尝试通过HTML表单将一个msword/doc文件上传到Apache服务器文件夹。在本地测试(通过MAMP测试)时,它可以正常工作,但是当我将其上传到远程服务器(例如GoDaddy)时,它就无法工作了。显示“文件上传出现问题”。
以下是处理文件上传的代码片段。我无法弄清楚我的条件语句有什么问题。
以下是处理文件上传的代码片段。我无法弄清楚我的条件语句有什么问题。
// Move the file to the target upload folder
$target = FILE_UPLOADPATH . basename($new_file);
if (move_uploaded_file($_FILES['new_file']['tmp_name'], $target))
{
// The new file move was successful, now make sure any old file is deleted
if (!empty($old_file) && ($old_file != $new_file))
{
@unlink(FILE_UPLOADPATH . $old_file);
}
}
else
{
// The new file move failed, so delete the temporary file and set the error flag
@unlink($_FILES['new_file']['tmp_name']);
echo 'There was a problem with the file upload.' . PHP_EOL;
}
var_dump(is_writable($target));
给你什么结果? - popthestack