//上传图片
public function uploadImg(Request $request){
$fileInfo = $_FILES['files']; //接收上传的图片
$file_path = './upload/'. date("Y") .'/'. date("m") . '/' .date('d');
if(!is_dir($file_path)){
mkdir($file_path,0777,true);
}
$filename=$fileInfo["tmp_name"];
$image_size = getimagesize($filename);
$pinfo=pathinfo($fileInfo["name"]);
$ftype=$pinfo['extension'];
$file_name = date('YmdHis',time()).mt_rand(1000,9999) . '.' . $ftype ;
$destination = $file_path.'/'.$file_name;
if(move_uploaded_file ($filename, $destination))
{
$new_path = 'https://dy.bjzhishanzhimei.com'.substr($file_path,1) .'/'. $file_name;
return $new_path;
}
}
注意:接收上传的图片使用$_FILES 接收方式与框架无关 !!!