如何在服务器上存储下载的文件,例如在脚本下载中心?您以什么方式存储上传的文件?添加到该名称,创建一个文件夹?对不起英文。
答案 0 :(得分:0)
您应该从PHP.net上阅读PHP: Handling file uploads。
$date = date("Ymd");
$rand = uniqid();
$uploaddir = "/home/files/{$date}/";
$uploadfile = $uploaddir . $IdCategory . '_' . $rand . '_' . basename($_FILES['userfile']['name']);
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.";
} else {
echo "Upload did not succeed.";
}