Commit 9d1c0df976c585ab44400bad6bc55ef7c5aae927

Authored by Conrad Vermeulen
1 parent f361a91b

WSA-1

"Problems with upload.php"
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7652 c91229c3-7414-0410-bfa2-8a42b809f60b
ktwebservice/KTUploadManager.inc.php
@@ -2,39 +2,39 @@ @@ -2,39 +2,39 @@
2 2
3 /** 3 /**
4 * 4 *
5 - * $Id:$ 5 + * $Id$
6 * 6 *
7 * KTUploadManager manages files in the uploaded_files table. 7 * KTUploadManager manages files in the uploaded_files table.
8 * 8 *
9 * KnowledgeTree Open Source Edition 9 * KnowledgeTree Open Source Edition
10 * Document Management Made Simple 10 * Document Management Made Simple
11 * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited 11 * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
12 - * 12 + *
13 * This program is free software; you can redistribute it and/or modify it under 13 * This program is free software; you can redistribute it and/or modify it under
14 * the terms of the GNU General Public License version 3 as published by the 14 * the terms of the GNU General Public License version 3 as published by the
15 * Free Software Foundation. 15 * Free Software Foundation.
16 - * 16 + *
17 * This program is distributed in the hope that it will be useful, but WITHOUT 17 * This program is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 19 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
20 * details. 20 * details.
21 - * 21 + *
22 * You should have received a copy of the GNU General Public License 22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <http://www.gnu.org/licenses/>. 23 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 - * 24 + *
25 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, 25 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
26 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. 26 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
27 - * 27 + *
28 * The interactive user interfaces in modified source and object code versions 28 * The interactive user interfaces in modified source and object code versions
29 * of this program must display Appropriate Legal Notices, as required under 29 * of this program must display Appropriate Legal Notices, as required under
30 * Section 5 of the GNU General Public License version 3. 30 * Section 5 of the GNU General Public License version 3.
31 - * 31 + *
32 * In accordance with Section 7(b) of the GNU General Public License version 3, 32 * In accordance with Section 7(b) of the GNU General Public License version 3,
33 * these Appropriate Legal Notices must retain the display of the "Powered by 33 * these Appropriate Legal Notices must retain the display of the "Powered by
34 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 34 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
35 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 35 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
36 - * must display the words "Powered by KnowledgeTree" and retain the original  
37 - * copyright notice. 36 + * must display the words "Powered by KnowledgeTree" and retain the original
  37 + * copyright notice.
38 * Contributor( s): ______________________________________ 38 * Contributor( s): ______________________________________
39 * 39 *
40 */ 40 */
@@ -91,7 +91,7 @@ class KTUploadManager @@ -91,7 +91,7 @@ class KTUploadManager
91 array( 91 array(
92 'tempfilename'=>$newtempfile, 92 'tempfilename'=>$newtempfile,
93 'filename'=>$filename, 93 'filename'=>$filename,
94 - 'userid'=>$this->userid, 94 + 'userid'=>$_SESSION['userID'],
95 'uploaddate'=>$now, 95 'uploaddate'=>$now,
96 'action'=>$action, 96 'action'=>$action,
97 // 'related_uploadid'=>$relatedid 97 // 'related_uploadid'=>$relatedid
@@ -104,13 +104,15 @@ class KTUploadManager @@ -104,13 +104,15 @@ class KTUploadManager
104 DBUtil::rollback(); 104 DBUtil::rollback();
105 return $id; 105 return $id;
106 } 106 }
  107 + global $php_errormsg;
  108 + $result = @move_uploaded_file($tempfile, $newtempfile);
  109 + $tmp = $php_errormsg;
107 110
108 - $result = move_uploaded_file($tempfile, $newtempfile);  
109 if ($result == false) 111 if ($result == false)
110 { 112 {
111 113
112 DBUtil::rollback(); 114 DBUtil::rollback();
113 - return false; 115 + return new PEAR_Error($tmp);
114 } 116 }
115 117
116 DBUtil::commit(); 118 DBUtil::commit();