Changeset 841 for pro-violet-viettel/www/deploy/20150304/application/modules/ajax/controllers/download.php
- Timestamp:
- Mar 27, 2015 11:36:13 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/www/deploy/20150304/application/modules/ajax/controllers/download.php
r831 r841 14 14 15 15 public function getFile () { 16 $file = $this->config->item('api_url').'uploads/space/3/3854/1.JPG'; 17 header('Content-Description: File Transfer'); 18 header('Content-Type: application/octet-stream'); 19 header('Content-Disposition: attachment; filename='.basename($file)); 20 header('Expires: 0'); 21 header('Cache-Control: must-revalidate'); 22 header('Pragma: public'); 23 header('Content-Length: ' . filesize($file)); 24 readfile($file); 16 $file= $this->input->post('file'); 17 $folder= $this->input->post('folder'); 18 $files = $this->vservices->actionExecute('getFiles',array("file"=>$file,"folder"=>$folder)); 19 echo "<pre>"; 20 print_r($files); 21 echo "</pre>"; 22 die(); 23 $file = file_get_contents($fileurl); 24 file_put_contents("1.jpg", $file); 25 $local_file="1.jpg"; 26 $download_rate = 512; 27 $download_file = $this->input->post('filename'); 28 29 // send headers 30 header('Cache-control: private'); 31 header('Content-Type: application/octet-stream'); 32 header('Content-Length: '.filesize($local_file)); 33 header('Content-Disposition: filename='.$download_file); 34 35 // flush content 36 flush(); 37 38 // open file stream 39 $file = fopen($local_file, "r"); 40 41 while (!feof($file)) { 42 43 // send the current file part to the browser 44 print fread($file, round($download_rate * 1024)); 45 46 // flush the content to the browser 47 flush(); 48 49 // sleep one second 50 sleep(1); 51 } 52 53 // close file stream 54 fclose($file); 55 25 56 exit; 26 57
Note: See TracChangeset
for help on using the changeset viewer.