summaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-07-05 17:39:41 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2013-07-05 17:39:41 +0200
commite159cbf527822edc28522df48b0526419835ca29 (patch)
treee1e64ac3cb2727a8157b2f893016e01e7422195c /apps/files
parent0202d47f7ad4a65d4e539421c4f5899404b22bf4 (diff)
downloadnextcloud-server-e159cbf527822edc28522df48b0526419835ca29.tar.gz
nextcloud-server-e159cbf527822edc28522df48b0526419835ca29.zip
on reshares we now recursively move to the root of all reshares - therefore some code has been refactured and added as a new public function
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/ajax/upload.php29
1 files changed, 14 insertions, 15 deletions
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php
index fd6aa981542..0a61ff72d41 100644
--- a/apps/files/ajax/upload.php
+++ b/apps/files/ajax/upload.php
@@ -27,25 +27,24 @@ 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::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'] : ''
);
- // handle reshare
- if (!empty($linkItem['parent'])) {
- $dir = '/Shared'.$dir;
- }
-
if (!$dir || empty($dir) || $dir === false) {
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']);
}
}
@@ -81,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();
}
@@ -113,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
);
}
}