Commit fed8a765c70fc7812084960dcea378c477d6e74e
1 parent
617c5461
Altered functionality to separte database document creation from file system document creation
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@622 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
20 additions
and
5 deletions
lib/documentmanagement/PhysicalDocumentManager.inc
| ... | ... | @@ -27,21 +27,20 @@ class PhysicalDocumentManager { |
| 27 | 27 | * @param Array containing file information. Must match $_FILES exactly |
| 28 | 28 | * @param Primary key of folder in which document will be stored |
| 29 | 29 | * @param Document description (should be passed through as a form variable) |
| 30 | - * @param Temporary path of file on server (get from $aFileArray['upfile']['tmp_name']) | |
| 30 | + * @param Temporary path of file on server (get from $aFileArray['fFile']['tmp_name']) | |
| 31 | 31 | * |
| 32 | 32 | * @return boolean true on successful upload and storage, false otherwise and set $_SESSION["errorMessage"] |
| 33 | 33 | * |
| 34 | 34 | * @todo add URL functionality |
| 35 | 35 | */ |
| 36 | 36 | |
| 37 | - function uploadPhysicalDocument($aFileArray, $iFolderID, $sDescription, $sTmpFilePath) { | |
| 37 | + /*function uploadPhysicalDocument($aFileArray, $iFolderID, $sDescription, $sTmpFilePath) { | |
| 38 | 38 | global $lang_fileexists, $lang_err_upload, $lang_err_database; |
| 39 | 39 | //create the document object |
| 40 | 40 | $oDocument = & PhysicalDocumentManager::createDocumentFromUploadedFile($aFileArray, $iFolderID); |
| 41 | 41 | $oDocument->setDescription($sDescription); |
| 42 | 42 | //find the path on the system where the document should be stored |
| 43 | - $sDocumentFileSystemPath = Folder::getFolderPath($oDocument->getFolderID()) . "/" . $oDocument->getName(); | |
| 44 | - var_dump($sDocumentFileSystemPath); | |
| 43 | + $sDocumentFileSystemPath = Folder::getFolderPath($oDocument->getFolderID()) . "/" . $oDocument->getName(); | |
| 45 | 44 | //copy the file accross |
| 46 | 45 | if (copy($sTmpFilePath, $sDocumentFileSystemPath)) { |
| 47 | 46 | //create the object in the database |
| ... | ... | @@ -61,6 +60,21 @@ class PhysicalDocumentManager { |
| 61 | 60 | $_SESSION["errorMessage"] = $lang_err_upload; |
| 62 | 61 | return false; |
| 63 | 62 | } |
| 63 | + }*/ | |
| 64 | + | |
| 65 | + function uploadPhysicalDocument($oDocument, $iFolderID, $sDescription, $sTmpFilePath) { | |
| 66 | + global $lang_fileexists, $lang_err_upload, $lang_err_database; | |
| 67 | + //find the path on the system where the document should be stored | |
| 68 | + $sDocumentFileSystemPath = Folder::getFolderPath($oDocument->getFolderID()) . "/" . $oDocument->getName(); | |
| 69 | + //copy the file accross | |
| 70 | + if (copy($sTmpFilePath, $sDocumentFileSystemPath)) { | |
| 71 | + //remove the temporary file | |
| 72 | + unlink($sTmpFilePath); | |
| 73 | + return true; | |
| 74 | + } else { | |
| 75 | + $_SESSION["errorMessage"] = $lang_err_upload; | |
| 76 | + return false; | |
| 77 | + } | |
| 64 | 78 | } |
| 65 | 79 | |
| 66 | 80 | /** |
| ... | ... | @@ -130,7 +144,8 @@ class PhysicalDocumentManager { |
| 130 | 144 | */ |
| 131 | 145 | function & createDocumentFromUploadedFile($aFileArray, $iFolderID) { |
| 132 | 146 | //get the uploaded document information and put it into a document object |
| 133 | - $oDocument = & new Document($aFileArray['upfile']['name'], $aFileArray['upfiler']['name'], $aFileArray['upfile']['size'], $_SESSION["userID"], PhysicalDocumentManager::getMimeTypeID($aFileArray['upfile']['type']), $iFolderID); | |
| 147 | + //$oDocument = & new Document($aFileArray['fFile']['name'], $aFileArray['fFiler']['name'], $aFileArray['fFile']['size'], $_SESSION["userID"], PhysicalDocumentManager::getMimeTypeID($aFileArray['fFile']['type']), $iFolderID); | |
| 148 | + $oDocument = & new Document($aFileArray['name'], $aFileArray['name'], $aFileArray['size'], $_SESSION["userID"], PhysicalDocumentManager::getMimeTypeID($aFileArray['type']), $iFolderID); | |
| 134 | 149 | return $oDocument; |
| 135 | 150 | } |
| 136 | 151 | ... | ... |