summaryrefslogtreecommitdiffstats
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.php26
1 files changed, 15 insertions, 11 deletions
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php
index 8433716dec1..dde5d3c50af 100644
--- a/apps/files/ajax/upload.php
+++ b/apps/files/ajax/upload.php
@@ -18,7 +18,6 @@ if (empty($_POST['dirToken'])) {
}
} else {
$linkItem = OCP\Share::getShareByToken($_POST['dirToken']);
-
if ($linkItem === false) {
OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Invalid Token')))));
die();
@@ -27,11 +26,18 @@ if (empty($_POST['dirToken'])) {
if (!($linkItem['permissions'] & OCP\PERMISSION_CREATE)) {
OCP\JSON::checkLoggedIn();
} else {
+ // resolve reshares
+ $rootLinkItem = OCP\Share::resolveReShare($linkItem);
+
+ // Setup FS with owner
+ OC_Util::tearDownFS();
+ OC_Util::setupFS($rootLinkItem['uid_owner']);
// The token defines the target directory (security reasons)
+ $path = \OC\Files\Filesystem::getPath($linkItem['file_source']);
$dir = sprintf(
"/%s/%s",
- $linkItem['file_target'],
+ $path,
isset($_POST['subdir']) ? $_POST['subdir'] : ''
);
@@ -39,8 +45,6 @@ if (empty($_POST['dirToken'])) {
OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Unable to set upload directory.')))));
die();
}
- // Setup FS with owner
- OC_Util::setupFS($linkItem['uid_owner']);
}
}
@@ -76,17 +80,17 @@ $files = $_FILES['files'];
$error = '';
-$maxUploadFilesize = OCP\Util::maxUploadFilesize($dir);
-$maxHumanFilesize = OCP\Util::humanFileSize($maxUploadFilesize);
+$maxUploadFileSize = $storageStats['uploadMaxFilesize'];
+$maxHumanFileSize = OCP\Util::humanFileSize($maxUploadFileSize);
$totalSize = 0;
foreach ($files['size'] as $size) {
$totalSize += $size;
}
-if ($maxUploadFilesize >= 0 and $totalSize > $maxUploadFilesize) {
+if ($maxUploadFileSize >= 0 and $totalSize > $maxUploadFileSize) {
OCP\JSON::error(array('data' => array('message' => $l->t('Not enough storage available'),
- 'uploadMaxFilesize' => $maxUploadFilesize,
- 'maxHumanFilesize' => $maxHumanFilesize)));
+ 'uploadMaxFilesize' => $maxUploadFileSize,
+ 'maxHumanFilesize' => $maxHumanFileSize)));
exit();
}
@@ -108,8 +112,8 @@ if (strpos($dir, '..') === false) {
'id' => $meta['fileid'],
'name' => basename($target),
'originalname' => $files['name'][$i],
- 'uploadMaxFilesize' => $maxUploadFilesize,
- 'maxHumanFilesize' => $maxHumanFilesize
+ 'uploadMaxFilesize' => $maxUploadFileSize,
+ 'maxHumanFilesize' => $maxHumanFileSize
);
}
}