繁花不似锦
public function downloadFileAction(){ if (isset($_REQUEST['file_name'])) { $pathFile = STORAGE_PATH.'/'.$_REQUEST['file_name']; header('Content-Description: File Transfer'); header('Content-Disposition: attachment; filename="'.$_REQUEST['file_name'].'"'); header('Content-Type: application/octet-stream'); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . filesize($pathFile)); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Expires: 0'); readfile($pathFile); }}public function uploadFile(array $file) { $storagePath = STORAGE_PATH; @mkdir($storagePath, 0777, true); $fullPath = $storagePath. uniqid (time()). $file['name']; $fileTemp = $file['tmp_name']; move_uploaded_file($fileTemp, $fullPath); return $fullPath; }在您的控制器中,您可以使用以下文件获取文件:$_FILES