Commit ea6baa72937a740ce2b8a7257507414b99fb3959

Authored by megan_w
1 parent 76eb592d

KTC-299

"Bulk Upload failed: File is not a zip file"
Fixed. Added check for application/zip.

Committed by: Megan Watson
Reviewed by: Conrad Vermeulen



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7839 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/ktcore/folder/BulkUpload.php
... ... @@ -5,32 +5,32 @@
5 5 * KnowledgeTree Open Source Edition
6 6 * Document Management Made Simple
7 7 * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
8   - *
  8 + *
9 9 * This program is free software; you can redistribute it and/or modify it under
10 10 * the terms of the GNU General Public License version 3 as published by the
11 11 * Free Software Foundation.
12   - *
  12 + *
13 13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 16 * details.
17   - *
  17 + *
18 18 * You should have received a copy of the GNU General Public License
19 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20   - *
  20 + *
21 21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
22 22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
23   - *
  23 + *
24 24 * The interactive user interfaces in modified source and object code versions
25 25 * of this program must display Appropriate Legal Notices, as required under
26 26 * Section 5 of the GNU General Public License version 3.
27   - *
  27 + *
28 28 * In accordance with Section 7(b) of the GNU General Public License version 3,
29 29 * these Appropriate Legal Notices must retain the display of the "Powered by
30   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
31 31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
32   - * must display the words "Powered by KnowledgeTree" and retain the original
33   - * copyright notice.
  32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
34 34 * Contributor( s): ______________________________________
35 35 *
36 36 */
... ... @@ -114,16 +114,17 @@ class KTBulkUploadFolderAction extends KTFolderAction {
114 114  
115 115 unset($aErrorOptions['message']);
116 116 $aFile = $this->oValidator->validateFile($_FILES['file'], $aErrorOptions);
117   -
  117 +
118 118 // Ensure file is a zip file
119 119 $sMime = $aFile['type'];
120 120 $pos = strpos($sMime, 'x-zip-compressed');
121   - if($pos === false){
  121 + $pos2 = strpos($sMime, 'application/zip');
  122 + if($pos === false && $pos2 === false){
122 123 $this->addErrorMessage(_kt("Bulk Upload failed: File is not a zip file."));
123 124 controllerRedirect("browse", 'fFolderId=' . $this->oFolder->getID());
124 125 exit(0);
125 126 }
126   -
  127 +
127 128 $matches = array();
128 129 $aFields = array();
129 130 foreach ($_REQUEST as $k => $v) {
... ... @@ -141,7 +142,7 @@ class KTBulkUploadFolderAction extends KTFolderAction {
141 142 $bm =& new KTBulkImportManager($this->oFolder, $fs, $this->oUser, $aOptions);
142 143 $this->startTransaction();
143 144 $res = $bm->import();
144   -
  145 +
145 146 $aErrorOptions['message'] = _kt("Bulk Upload failed");
146 147 $this->oValidator->notError($res, $aErrorOptions);
147 148  
... ...