|
|
|
@ -48,15 +48,11 @@ if(strpos($dir, '..') === false) { |
|
|
|
|
$fileCount=count($files['name']); |
|
|
|
|
for($i=0;$i<$fileCount;$i++) { |
|
|
|
|
$target = OCP\Files::buildNotExistingFileName(stripslashes($dir), $files['name'][$i]); |
|
|
|
|
// $path needs to be normalized - this failed within drag'n'drop upload to a sub-folder |
|
|
|
|
$target = OC_Filesystem::normalizePath($target); |
|
|
|
|
if(is_uploaded_file($files['tmp_name'][$i]) and OC_Filesystem::fromTmpFile($files['tmp_name'][$i], $target)) { |
|
|
|
|
$meta = OC_FileCache::get($target); |
|
|
|
|
$id = OC_FileCache::getId($target); |
|
|
|
|
// in case the upload goes to a sub directory getID() returns -1 and $target needs to be normalized |
|
|
|
|
// calling normalizePath() inside getId() causes endless scan. |
|
|
|
|
if ($id == -1) { |
|
|
|
|
$path = OC_Filesystem::normalizePath($target); |
|
|
|
|
$id = OC_FileCache::getId($path); |
|
|
|
|
} |
|
|
|
|
$result[]=array( "status" => "success", 'mime'=>$meta['mimetype'], 'size'=>$meta['size'], 'id'=>$id, 'name'=>basename($target)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|