Changeset 507 for trunk/Modules/File/File.php
- Timestamp:
- Apr 1, 2013, 7:14:59 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/File/File.php
r506 r507 54 54 { 55 55 $DbRow = $DbResult->fetch_assoc(); 56 if(file_exists($this->FilesDir.'/'.$DbRow['Name'])) 56 if($DbRow['Directory'] != '') $FileName = $this->GetDir($DbRow['Directory']); 57 else $FileName = $this->FilesDir; 58 $FileName .= $DbRow['Name']; 59 if(file_exists($FileName)) 57 60 { 58 Header('Content-Type: '.$this->DetectMimeType($ this->FilesDir.'/'.$DbRow['Name']));61 Header('Content-Type: '.$this->DetectMimeType($FileName)); 59 62 Header('Content-Disposition: attachment; filename="'.$DbRow['Name'].'"'); 60 echo(file_get_contents($ this->FilesDir.'/'.$DbRow['Name']));63 echo(file_get_contents($FileName)); 61 64 } else echo('Soubor nenalezen!'); 62 65 } else echo('Soubor nenalezen!'); 63 66 } 67 68 function GetDir($Id) 69 { 70 $DbResult = $this->Database->select('FileDirectory', '*', 'Id='.$Id); 71 $DbRow = $DbResult->fetch_assoc(); 72 if($DbRow['Parent'] != '') $Result = $this->GetDir($DbRow['Parent']); 73 else $Result = $this->FilesDir; 74 $Result .= $DbRow['Name'].'/'; 75 return($Result); 76 } 64 77 } 78 65 79 66 80 class PageFile extends Page … … 73 87 } 74 88 } 75 76 89 77 90 class ModuleFile extends AppModule … … 105 118 $this->System->RegisterPage('file', 'PageFile'); 106 119 $File = new File($this->System->Database); 107 $File->FilesDir = dirname(__FILE__).'/../../'.$Config['Web']['UploadFileFolder'] .'/';120 $File->FilesDir = dirname(__FILE__).'/../../'.$Config['Web']['UploadFileFolder']; 108 121 $this->System->AddModule($File); 109 122 }
Note:
See TracChangeset
for help on using the changeset viewer.