Rumah >pembangunan bahagian belakang >tutorial php >这是PHP上传文件代码,怎样更换上传目录
foreach($_FILES as $f)
{
//处理中文名
if (function_exists("iconv")) $f[name] = iconv("UTF-8","GB2312",$f[name]);
//检查是否已经存在同名文件
if (file_exists($f[name])) header("HTTP/1.0 403");
//保存文件
if (!@move_uploaded_file($f["tmp_name"],$f[name])) header("HTTP/1.0 404 Not Found");
echo "1";
}
怎样把上传目录换成D://www这个文件夹下?
move_uploaded_file($f["tmp_name"], ‘d:/www/' . $f[name])
move_uploaded_file($f["tmp_name"], ‘d:/www/' . $f[name])
$name = pathinfo('a.txt', PATHINFO_FILENAME);echo $name;
不明白你在说什么
$name = pathinfo('a.txt', PATHINFO_FILENAME);
echo $name;