时间:2021-07-01 10:21:17 帮助过:22人阅读
File Upload
function processFile($files, $type) { $uploadName = null; foreach ($files as $name => $value) { $originalName = $value['name']; $arr = explode(".", $originalName); $postfix = $arr[count($arr) - 1]; $tmpPath = $value['tmp_name']; $tmpType = $value['type']; $tmpSize = $value['size']; } $newname = EhlStaticFunction::generateRandomStr(40).".".$postfix; switch ($type) { case 1 : // 处理声音文件 $destination = VIDEOUPLOADDIR.$newname; break; case 2 : // 处理图像文件 $destination = IMAGEUPLOADDIR.$newname; break; } move_uploaded_file($tmpPath, $destination); }
http://www.bkjia.com/PHPjc/664289.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/664289.htmlTechArticle前言 这星期一直再搞php,涉及到文件上传的部分有些遗忘,这里记录一下 HTML的form表单 用html的表单模拟一个文件上传的post请求,代码如下...