时间:2021-07-01 10:21:17 帮助过:4人阅读
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'].$_REQUEST['folder'] . '/';
$ext = pathinfo($_FILES['Filedata']['name']);
$ext = $ext['extension'];
if ($ext=='doc'||$ext=='pdf'||$ext=='txt')
{
$name = md5(uniqid(rand().microtime())).'.'.$ext;
$targetFile = str_replace('//','/',$targetPath) . $name;
}
move_uploaded_file($tempFile,iconv('utf-8','gbk', $targetFile));//这里已经执行了
$path = str_replace($_SERVER['DOCUMENT_ROOT'],'',$targetFile);
$param = array(
'name' => $name,
'path' => $path
);
$data = Http::connect(CURL_HOST, CURL_PORT)->doPost(EN_SITEURL.'open.php/blog/logatt',$param, 'json');