Ignore:
Timestamp:
Mar 31, 2015 9:56:50 AM (10 years ago)
Author:
quyenla
Message:

download

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/www/deploy/20150304/application/modules/ajax/controllers/download.php

    r841 r858  
    1414       
    1515        public function getFile () {
    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>";
     16                $data=  $this->input->post('data');
     17                $treeArray=  json_decode($data,TRUE);
     18           
     19                if ((count($treeArray)==1) && ($treeArray[0]['type']=='file'))
     20                {
     21                    $file=$treeArray[0];
     22                    echo $file['name'];
     23                    $file = file_get_contents($treeArray[0]['fileurl']); 
     24                    $local_file="".$treeArray[0]['name'];
     25                    file_put_contents($local_file, $file);
     26                    $download_rate = 512;
     27                    $download_file = $treeArray[0]['name'];
     28                }
    2229                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               
     31               
     32               
     33               
     34               
     35               
     36               
     37               
     38               
     39               
     40
     41
     42   // send headers
     43
    3044    header('Cache-control: private');
    3145    header('Content-Type: application/octet-stream');
     
    3347    header('Content-Disposition: filename='.$download_file);
    3448 
     49   
    3550    // flush content
    3651    flush();
Note: See TracChangeset for help on using the changeset viewer.