'; if(isset($idx->input['fselect'])) { foreach($idx->input['fselect'] as $id=>$filename) echo $filename.'
'.END; } */ class download { var $entry; var $files=array(); function download() { global $idx,$std; $this->entry=$idx->input['entry']; if(!isset($idx->input['fselect'])) { $std->print_error("You have not yet select any file",0); exit; } else { $this->files=$idx->input['fselect']; } } //------------------------------------------------------------------------------ function get_files() { global $idx,$std; $path=''; if(count($this->files)==1) { $path=$this->entry.'/'.current($this->files); } else if(is_file($this->entry))$path=$this->entry; if($path!='') { $ok=fileperms($path); if(!$ok) { $std->print_error('Could not download '.$path); exit; } $len = filesize($path); $short_name=basename($path); //show it header('Content-Disposition: attachment; filename='.$short_name); if(function_exists('mime_content_type')) header('Content-type: '.mime_content_type($path)); header('Content-Length: '.$len); readfile($path); return 1; } return 0; } //------------------------------------------------------------------------------ function content() { $ret=''; foreach($this->files as $id => $fname) { $full_name=$this->entry.'/'.$fname; echo $full_name; echo "
"; } return $ret; } }//of class $dl=new download(); $dl->get_files(); ?>