aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2013-09-06 18:16:40 +0200
committerJörn Friedrich Dreyer <jfd@butonic.de>2013-09-06 18:16:40 +0200
commite2c0fe829698de9f89bf2cc3f854942f44bffc69 (patch)
tree72eb928d85a5353ec27d969ab31330d20b8ffad5
parent238d92b11cab31061fb5766b9f75d4772d48283e (diff)
downloadnextcloud-server-e2c0fe829698de9f89bf2cc3f854942f44bffc69.tar.gz
nextcloud-server-e2c0fe829698de9f89bf2cc3f854942f44bffc69.zip
fix upload of multiple files
-rw-r--r--apps/files/ajax/upload.php61
-rw-r--r--apps/files/js/file-upload.js4
2 files changed, 40 insertions, 25 deletions
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php
index 60c2454b290..12724c0c5bc 100644
--- a/apps/files/ajax/upload.php
+++ b/apps/files/ajax/upload.php
@@ -111,41 +111,56 @@ if (strpos($dir, '..') === false) {
) {
// upload and overwrite file
if (is_uploaded_file($files['tmp_name'][$i]) and \OC\Files\Filesystem::fromTmpFile($files['tmp_name'][$i], $target)) {
- $status = 'success';
-
+
// updated max file size after upload
$storageStats = \OCA\files\lib\Helper::buildFileStorageStatistics($dir);
+ $meta = \OC\Files\Filesystem::getFileInfo($target);
+ if ($meta === false) {
+ $error = $l->t('Upload failed. Could not get file info.');
+ } else {
+ $result[] = array('status' => 'success',
+ 'mime' => $meta['mimetype'],
+ 'mtime' => $meta['mtime'],
+ 'size' => $meta['size'],
+ 'id' => $meta['fileid'],
+ 'name' => basename($target),
+ 'originalname' => $files['tmp_name'][$i],
+ 'uploadMaxFilesize' => $maxUploadFileSize,
+ 'maxHumanFilesize' => $maxHumanFileSize
+ );
+ }
+
} else {
$error = $l->t('Upload failed. Could not find uploaded file');
}
} else {
// file already exists
- $status = 'existserror';
- }
- }
- if ($error === false) {
- $meta = \OC\Files\Filesystem::getFileInfo($target);
- if ($meta === false) {
- $error = $l->t('Upload failed. Could not get file info.');
- } else {
- $result[] = array('status' => $status,
- 'mime' => $meta['mimetype'],
- 'mtime' => $meta['mtime'],
- 'size' => $meta['size'],
- 'id' => $meta['fileid'],
- 'name' => basename($target),
- 'originalname' => $files['tmp_name'][$i],
- 'uploadMaxFilesize' => $maxUploadFileSize,
- 'maxHumanFilesize' => $maxHumanFileSize
- );
- OCP\JSON::encodedPrint($result);
- exit();
+ $meta = \OC\Files\Filesystem::getFileInfo($target);
+ if ($meta === false) {
+ $error = $l->t('Upload failed. Could not get file info.');
+ } else {
+ $result[] = array('status' => 'existserror',
+ 'mime' => $meta['mimetype'],
+ 'mtime' => $meta['mtime'],
+ 'size' => $meta['size'],
+ 'id' => $meta['fileid'],
+ 'name' => basename($target),
+ 'originalname' => $files['tmp_name'][$i],
+ 'uploadMaxFilesize' => $maxUploadFileSize,
+ 'maxHumanFilesize' => $maxHumanFileSize
+ );
+ }
}
}
} else {
$error = $l->t('Invalid directory.');
}
-OCP\JSON::error(array('data' => array_merge(array('message' => $error), $storageStats)));
+if ($error === false) {
+ OCP\JSON::encodedPrint($result);
+ exit();
+} else {
+ OCP\JSON::error(array('data' => array_merge(array('message' => $error), $storageStats)));
+}
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index 3fcda22e53e..4f93403baf5 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -536,8 +536,8 @@ $(document).ready(function() {
//}
//if user pressed cancel hide upload chrome
//if (! OC.Upload.isProcessing()) {
- // $('#uploadprogresswrapper input.stop').fadeOut();
- // $('#uploadprogressbar').fadeOut();
+ $('#uploadprogresswrapper input.stop').fadeOut();
+ $('#uploadprogressbar').fadeOut();
//}
});
fileupload.on('fileuploadfail', function(e, data) {