}
}
- 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;
}
}
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]);
}