aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/ajax/upload.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/ajax/upload.php')
-rw-r--r--apps/files/ajax/upload.php24
1 files changed, 14 insertions, 10 deletions
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php
index dde5d3c50af..1d03cd89f83 100644
--- a/apps/files/ajax/upload.php
+++ b/apps/files/ajax/upload.php
@@ -105,16 +105,20 @@ if (strpos($dir, '..') === false) {
$meta = \OC\Files\Filesystem::getFileInfo($target);
// updated max file size after upload
$storageStats = \OCA\files\lib\Helper::buildFileStorageStatistics($dir);
-
- $result[] = array('status' => 'success',
- 'mime' => $meta['mimetype'],
- 'size' => $meta['size'],
- 'id' => $meta['fileid'],
- 'name' => basename($target),
- 'originalname' => $files['name'][$i],
- 'uploadMaxFilesize' => $maxUploadFileSize,
- 'maxHumanFilesize' => $maxHumanFileSize
- );
+ if ($meta === false) {
+ OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Upload failed')), $storageStats)));
+ exit();
+ } else {
+ $result[] = array('status' => 'success',
+ 'mime' => $meta['mimetype'],
+ 'size' => $meta['size'],
+ 'id' => $meta['fileid'],
+ 'name' => basename($target),
+ 'originalname' => $files['name'][$i],
+ 'uploadMaxFilesize' => $maxUploadFileSize,
+ 'maxHumanFilesize' => $maxHumanFileSize
+ );
+ }
}
}
OCP\JSON::encodedPrint($result);