Exemple #1
0
 public function action_file($size = null, $file_cate = null, $split_num = null, $file_name = null)
 {
     $file_name = sprintf('%s.%s', $file_name, Input::extension());
     $config = array('type' => 'file', 'file_cate' => $file_cate, 'split_num' => $split_num, 'size' => $size, 'file_name' => $file_name);
     $file = new Site_FileMaker($config);
     if (!($data = $file->get_data())) {
         throw new HttpNotFoundException();
     }
     $ext = $file->get_extension();
     $accept_exts = conf('upload.types.file.accept_format');
     return Response::forge($data, 200, array('Content-Type' => $accept_exts[$ext]));
 }
Exemple #2
0
 public static function get_file_path4file_name($file_name, $size = 'raw')
 {
     $file_name_infos = explode('_', $file_name);
     $config = array('file_cate' => $file_name_infos[0], 'split_num' => $file_name_infos[1], 'file_name' => $file_name_infos[2], 'size' => $size);
     $file = new \Site_FileMaker($config);
     return $file->get_file_path();
 }