Upload all files
@param array $files
@param string $path
@return array|null
969401
public function uploadAll($files,$path){
        if( is_array($files) && count($files) > 0 ){
            $n = count($files);
            if( $n <= $this->config['upload']['number'] ){
                $res = array();
                $notresult = array();
                foreach ($files as $key => $value) {
                    $file = $this->upload($value,$path);
                    if( $file ){
                        $this->createThumb($file,$path);
                        $res[] = $file->getFilename();
                    }else{
                        $notresult[] = $value->getClientOriginalName();
                    }
                }
                $r = '';
                $n2 = count($res);
                $result = array("query"=>"BE_UPLOADALL_UPLOADS %s / %s","params"=>array($n2,$n));
                if(count($notresult)>0){
                    $result['query'] = $result['query'].' | BE_UPLOADALL_NOT_UPLOADS ';
                    $i=0;
                    $n = count($notresult);
                    foreach ($notresult as $value) {
                        $result['query'] = $result['query'] . ' %s';
                        if( $n - 1 > $i ){
                            $result['query'] = $result['query'] . ',';
                            $value = $value.',';
                        }
                        $result['params'][] = $value;
                        $i++;

                    }
                    $this->setInfo(array("status"=>0));
                }
                $this->setInfo(array("msg"=>$result));
                return $res;
            }else{
                $result = array("query"=>"BE_UPLOAD_MAX_UPLOAD %s","params"=>array($this->config['upload']['number']));
                $this->setInfo(array("msg"=>$result,"status"=>0));
            }
        }else{
            return ;
        }
    }
1144220
public function attach(array $files)
    {
        foreach ($files as $key => $file) {
            if (is_array($file)) {
                $file = new UploadedFile($file['path'], basename($file['path']), $file['mime'], $file['size']);
            } elseif (is_string($file)) {
                $finfo = finfo_open(FILEINFO_MIME_TYPE);

                $file = new UploadedFile($file, basename($file), finfo_file($finfo, $file), $this->files->size($file));
            } elseif (! $file instanceof UploadedFile) {
                continue;
            }

            $this->uploads[$key] = $file;
        }

        return $this;
    }
129238
public function setUploadDir($path)
	{
		$path = str_replace(' ', '_', trim($path));
		$path = Util::normalizePath($path);

		$this->uploadDir = ($path ? $path : $this->uploadDir);

		return $this;
	}
333614
protected  function createManifest($path, $files)
    {
        $data = [ ];
        foreach ( $files as $file ) {
            $data[] = [
                'type'      => $file[ 'type' ],
                'name'      => $file[ 'entity' ][ 'name' ],
                'full_name' => $file[ 'entity' ][ 'full_name' ],
                'namespace' => $file[ 'entity' ][ 'namespace' ],
            ];
        }
        $this->fs->put($path, Util::exportArray($data));
        return $data;
    }
953179
public function set(array $files)
    {
        if (!empty($files)) {
            foreach ($files as $_file) {
                if (is_array($_file) && isset($_file['file'])) {
                    $this->add(
                        $_file['file'],
                        isset($_file['media']) ? $_file['media'] : '',
                        isset($_file['condition']) ? $_file['condition'] : null
                    );
                } elseif (is_string($_file)) {
                    $this->add($_file);
                }
            }
        }
        return $this;
    }
954029
public function handleFiles(array $files): array
    {
        $this->removeOldFiles();
        $metadata = [];
        foreach ($files as $file) {
            /**@var $file  UploadedFile */
            if ($file->getError() == UPLOAD_ERR_OK) {
                $originalName = $file->getClientOriginalName();
                $extension = $file->getClientOriginalExtension();
                /**@var $newFile  File */
                if ($newFile = $file->move($this->uploadDir, md5(time().basename($originalName)) . '.' . $extension)) {
                    $metadata[$originalName] = [
                        'host_url'    => $this->hostUrl,
                        'path'        => $newFile->getPathname(),
                        'origin_name' => $originalName,
                        'type'        => $newFile->getMimeType(),
                        'size'        => $newFile->getSize(),
                        'extension'   => $extension
                    ];
                } else {
                    throw new FileUploadException('File upload error');
                }
            }
        }

        return $metadata;
    }
738235
public function upload($file, $path='')
	{
		$path = ltrim($path, '/');
		$path = rtrim($path, '/');
		$basePath = $this->getImageBasePath();
		$imagePath = $basePath.'/'.$path;

		if (!File::exists($imagePath)) {
			throw new ImageUploaderException("Directory {$path} doesn't exists");
		}

		$uploadedFile = $this->getUploadedFile($file);
		$fileName = $this->generateFileName($uploadedFile->getClientOriginalExtension());
		$uploadedFile->move($imagePath, $fileName);

		if (!is_null($this->temporaryImage)) {
			File::delete($this->temporaryImage);
		}

		return $path.'/'.$fileName;
	}
271622
public function addFiles(array $files)
    {
        $added_files = 0;
        try {
            foreach ($files as $localName => $filename) {
                if (!is_null($filename)) {
                    $this->sevenZip->addEntry($filename);
                    $this->sevenZip->renameEntry($filename, $localName);
                    $added_files++;
                }
            }
        } catch (Exception $e) {
            throw new Exception('Could not modify archive: '.$e->getMessage(), $e->getCode(), $e);
        }
        return $added_files;
    }
1295210
public function setFiles(array $files)
    {
        $this->files = array();
        foreach ($files as $key => $file) {
            if (!is_array($file)) {
                $file = array('content' => $file);
            }

            $file = array_merge(array(
                'content' => null,
                'mtime' => null,
            ), $file);

            $this->setFile($key, $file['content'], $file['mtime']);
        }
    }
286717
protected static function findFile($file, array $paths)
    {
        if ($file === null) {
            return null;
        }
        foreach ($paths as $path) {
            $files = glob("$path/$file");
            if (!empty($files)) {
                return $files[0];
            }
        }
    }
1185898
protected function setUploadedFiles(array &$files)
    {
        $isUploadedFiles = ($files === $_FILES);
        
        $this->files =& $files;
        $this->uploadedFiles = $this->groupUploadedFiles($files, null, $isUploadedFiles);
    }
1171786
protected  function createFiles($path, $files)
    {

        $this->fs->ensureDirectory($path);
        foreach ( $files as $file ) {
            $fileName = Util::toFileName($file->entity[ 'full_name' ], '.dat');
            #$export   = Util::exportArray($file->toArray());
            $export = serialize($file);
            $this->fs->put(path_join($path, $fileName), $export);
        }
    }
299190
public static function validateUploadedFiles(array $files)
    {
        foreach ($files as $file) {
            if (is_array($file)) {
                static::validateUploadedFiles($file);

                continue;
            }

            if (!$file instanceof UploadedFileInterface) {
                return false;
            }
        }

        return true;
    }
1214503
protected static function convertFiles($data, $files, $path = '')
    {
        foreach ($files as $key => $file) {
            $newPath = $path;
            if ($newPath === '') {
                $newPath = $key;
            }
            if ($newPath !== $key) {
                $newPath .= '.' . $key;
            }

            if (is_array($file)) {
                $data = static::convertFiles($data, $file, $newPath);
            } else {
                $data = Hash::insert($data, $newPath, static::convertFile($file));
            }
        }

        return $data;
    }
1349919
public function upload($path, $target)
	{
		$path   = Util::normalizePath($path);
		$target = Util::normalizePath($target);

		return $this->adapter->upload($path, $target);
	}
408645
public function setFiles(array $files) {
        if(!$this->setModified('files', $files)->isModified()) {
            return $this;
        }
		$this->files = $files;
		return $this;
    }
1185155
static public function uploadUrl($path)
    {
        if (strpos($path, 'images') === 0) {
            return Config::getRootUrl($path);
        }
        
        return Config::getUploadFileUrl($path);
    }