diff options
author | Luke Policinski <lpolicinski@gmail.com> | 2014-02-19 21:23:39 +0000 |
---|---|---|
committer | Luke Policinski <lpolicinski@gmail.com> | 2014-02-19 21:23:39 +0000 |
commit | 79a6d89bccf4c5d4ce934c88bc544988c47b8e98 (patch) | |
tree | f368fc7893294e023bbefae1c0e8ae961cc48217 /apps/files/ajax/upload.php | |
parent | a4f71267f0c7ef7a2a8d23ac0a47279ed8bdda5e (diff) | |
download | nextcloud-server-79a6d89bccf4c5d4ce934c88bc544988c47b8e98.tar.gz nextcloud-server-79a6d89bccf4c5d4ce934c88bc544988c47b8e98.zip |
Feature Added : Ability to drag and drop in Chrome
Diffstat (limited to 'apps/files/ajax/upload.php')
-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 145f40c50da..b2aa7a99200 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -103,22 +103,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) |