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; }
protected function save_file2storage($file_path, $filename_with_prefix) { if ($this->options['storage_type'] == 'db') { Model_FileBin::save_from_file_path($file_path, $filename_with_prefix, $this->options['upload_type'] == 'img'); } elseif ($this->options['storage_type'] == 'S3') { Site_S3::save($file_path, $filename_with_prefix, $this->options['upload_type']); } }