Home  >  Article  >  Backend Development  >  这是PHP上传文件代码,怎么更换上传目录

这是PHP上传文件代码,怎么更换上传目录

WBOY
WBOYOriginal
2016-06-13 11:58:31845browse

这是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 ([email protected]_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])

------解决方案--------------------
$name = pathinfo('a.txt', PATHINFO_FILENAME);
echo $name;

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn