diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-04-07 22:20:44 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-04-07 22:28:16 +0200 |
commit | 3587c88fe946196af009d02db7c7d5e2c8934fe9 (patch) | |
tree | a18ce4f6cb6acd08f082cb365f42f25a4b691c21 /apps/files/ajax | |
parent | be9bc2c727e59ced01f86bc1781ac586f92bc29f (diff) | |
parent | 089052b13af7a5e27d225ab345616511f4eaf2a9 (diff) | |
download | nextcloud-server-3587c88fe946196af009d02db7c7d5e2c8934fe9.tar.gz nextcloud-server-3587c88fe946196af009d02db7c7d5e2c8934fe9.zip |
Merge branch 'master' of https://github.com/lukepolo/core-1 into lukepolo-master
Conflicts:
apps/files/js/file-upload.js
Diffstat (limited to 'apps/files/ajax')
-rw-r--r-- | apps/files/ajax/upload.php | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index b21a9dfba2e..38175fa5001 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -111,22 +111,32 @@ if ($maxUploadFileSize >= 0 and $totalSize > $maxUploadFileSize) { } $result = array(); +$directory = ''; if (strpos($dir, '..') === false) { $fileCount = count($files['name']); for ($i = 0; $i < $fileCount; $i++) { + + // Get the files directory + if(isset($_POST['file_directory']) === true) { + $directory = '/'.$_POST['file_directory']; + } + // $path needs to be normalized - this failed within drag'n'drop upload to a sub-folder if (isset($_POST['resolution']) && $_POST['resolution']==='autorename') { // append a number in brackets like 'filename (2).ext' - $target = OCP\Files::buildNotExistingFileName(stripslashes($dir), $files['name'][$i]); + $target = OCP\Files::buildNotExistingFileName(stripslashes($dir.$directory), $files['name'][$i]); } else { - $target = \OC\Files\Filesystem::normalizePath(stripslashes($dir).'/'.$files['name'][$i]); + $target = \OC\Files\Filesystem::normalizePath(stripslashes($dir.$directory).'/'.$files['name'][$i]); } - - $directory = \OC\Files\Filesystem::normalizePath(stripslashes($dir)); - if (isset($public_directory)) { - // If we are uploading from the public app, - // we want to send the relative path in the ajax request. - $directory = $public_directory; + + if(empty($directory) === true) + { + $directory = \OC\Files\Filesystem::normalizePath(stripslashes($dir)); + if (isset($public_directory)) { + // If we are uploading from the public app, + // we want to send the relative path in the ajax request. + $directory = $public_directory; + } } if ( ! \OC\Files\Filesystem::file_exists($target) |