我正在尝试将客户端文件上传到我的服务器(使用“ post”方法从html表单中),在$ upldfile变量上运行程序,然后将程序结果显示为客户端的可下载链接。
我的代码在下面列出,每次我运行此代码时,都会收到“文件上传失败”的通知。
有谁知道这是基于权限的问题还是服务器错误或代码问题?
预先感谢大家提供的任何帮助
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$destination_path = getcwd().DIRECTORY_SEPARATOR;
$target_path = $destination_path . "uploads/" . basename( $_FILES["file"{["name"]);
$upldfile = move_uploaded_file($_FILES['file']['tmp_name'], $target_path);
if ($upldfile){
echo "<p>File upload success.</p>";
} else {
echo "<p>File upload failed.";
}
回答:
适当地更改权限,
并且
修改php.ini文件以允许上传更大的文件。
原始文件中的代码本身是正确的。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句