You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
738 B

5 years ago
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3. class Download extends WB_Controller
  4. {
  5. function attach($att_idx="") {
  6. if(empty($att_idx))
  7. {
  8. alert('잘못된 접근입니다.');
  9. }
  10. if(! $att = $this->db->where('att_idx', $att_idx)->get('attach')->row_array())
  11. {
  12. alert('잘못된 접근입니다.');
  13. exit;
  14. }
  15. $this->db->where('att_idx', $att['att_idx'])->set('att_downloads', 'att_downloads + 1', FALSE)->update('attach');
  16. $this->load->helper('download');
  17. $data = file_get_contents(FCPATH.$att['att_filepath']);
  18. $name = urlencode($att['att_origin']);
  19. force_download($name, $data);
  20. }
  21. }