示例#1
0
 protected function save_file_bin($tmp_file_path)
 {
     switch ($this->options['storage_type']) {
         case 'db':
             $storage_save_result = (bool) Model_FileBin::save_from_file_path($tmp_file_path, $this->file->name);
             break;
         case 'S3':
             $storage_save_result = (bool) Site_S3::save($tmp_file_path, null, $this->options['upload_type']);
             break;
         case 'normal':
         default:
             $storage_save_result = true;
             break;
     }
     if (!$storage_save_result) {
         Util_File::remove($tmp_file_path);
         throw new FuelException('Save raw file error to storage.');
     }
     if (!($result = (bool) Util_file::move($tmp_file_path, $this->file->file_path))) {
         throw new FuelException('Save raw file error.');
     }
     return $storage_save_result && $result;
 }