]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix bugs preventing file upload in shared folders with write permission
authorMichael Gapczynski <GapczynskiM@gmail.com>
Sat, 20 Aug 2011 16:36:20 +0000 (12:36 -0400)
committerMichael Gapczynski <GapczynskiM@gmail.com>
Sat, 20 Aug 2011 16:36:20 +0000 (12:36 -0400)
apps/files_sharing/sharedstorage.php
files/ajax/upload.php

index e2147bea4924958973147f0f7a37dd793d41027b..afe173ad0cc64e86c1879b08671d007ffb3272ca 100644 (file)
@@ -494,11 +494,15 @@ class OC_Filestorage_Shared extends OC_Filestorage {
                }
        }
        
-       public function fromUploadedFile($tmpPath, $path) {
-               $source = $this->getSource($tmpPath);
-               if ($source) {
-                       $storage = OC_Filesystem::getStorage($source);
-                       return $storage->fromUploadedFile($this->getInternalPath($source), $path);
+       public function fromUploadedFile($tmpFile, $path) {
+               if ($this->is_writeable($path)) {
+                       $source = $this->getSource($path);
+                       if ($source) {
+                               $storage = OC_Filesystem::getStorage($source);
+                               return $storage->fromUploadedFile($tmpFile, $this->getInternalPath($source));
+                       }
+               } else {
+                       return false;
                }
        }
        
index 4247aeca2834e3368f0c14c31d87bccb805d827f..2c0afa33a7d05ccefda545a883576d3374ac6207 100644 (file)
@@ -33,7 +33,7 @@ $result=array();
 if(strpos($dir,'..') === false){
        $fileCount=count($files['name']);
        for($i=0;$i<$fileCount;$i++){
-               $target='/' . stripslashes($dir) . $files['name'][$i];
+               $target=stripslashes($dir) . $files['name'][$i];
                if(OC_Filesystem::fromUploadedFile($files['tmp_name'][$i],$target)){
                        $result[]=array( "status" => "success", 'mime'=>OC_Filesystem::getMimeType($target),'size'=>OC_Filesystem::filesize($target),'name'=>$files['name'][$i]);
                }