Changeset 500 for trunk/Common/Types/File/File.php
- Timestamp:
- Mar 10, 2013, 10:08:23 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Types/File/File.php
r428 r500 1 1 <?php 2 2 3 class TypeFile 3 class TypeFile extends TypeBase 4 4 { 5 var $UploadFileFolder; 6 var $FileDownloadURL; 7 var $DirectoryId; 8 9 function __construct() 10 { 11 $this->FileDownloadURL = 'File.php'; 12 $this->DirectoryId = null; 13 } 14 5 15 function OnView($Item) 6 16 { … … 11 21 { 12 22 $DbRow = $DbResult->fetch_assoc(); 13 return('<a href=" types/File/FileDownload.php?Id='.$Item['Value'].'">'.$DbRow['Name'].'</a> ('.HumanSize($DbRow['Size']).')');23 return('<a href="'.$this->FileDownloadURL.'?Id='.$Item['Value'].'">'.$DbRow['Name'].'</a> ('.HumanSize($DbRow['Size']).')'); 14 24 } else return(''); 15 25 } … … 29 39 30 40 $Result = 0; 31 //print_r($_FILES); 41 print_r($_FILES); 42 print_r($_POST); 32 43 if(array_key_exists($Item['Name'], $_FILES) and ($_FILES[$Item['Name']]['name'] != '')) 33 44 { … … 35 46 { 36 47 $FileName = substr($_FILES[$Item['Name']]['name'], strrpos($_FILES[$Item['Name']]['name'], '/')); 37 $Database->query('INSERT INTO SystemFile (`Name`, `Size`) VALUES ("'.$FileName.'", '.filesize($_FILES[$Item['Name']]['tmp_name']).')'); 48 $Database->insert('File', array('Name' => $FileName, 'Size' => filesize($_FILES[$Item['Name']]['tmp_name']), 49 'Directory' => $this->DirectoryId)); 38 50 $Result = $Database->insert_id; 39 if(!move_uploaded_file($_FILES[$Item['Name']]['tmp_name'], $Config['UploadFileFolder'].'/'.$Result)) SystemMessage('Nahrání souboru', 'Cílová složka není dostupná!'); 51 if(!move_uploaded_file($_FILES[$Item['Name']]['tmp_name'], $this->UploadFileFolder.'/'.$Result)) 52 SystemMessage('Nahrání souboru', 'Cílová složka není dostupná!'); 40 53 } 41 54 }
Note:
See TracChangeset
for help on using the changeset viewer.