current upload process

@param $file array

@return bool
@throws FileException
187132
public function upload($file = null)
    {

        if (empty($file) || !is_array($file)) return false;

        $this->u_tmp_name  = $file['tmp_name'];
        $this->u_name      = $file['name'];
        $this->u_size      = $file['size'];
        $this->u_mime_type = $file['type'];
        $this->u_error     = isset($file['error']) ? $file['error'] : null;

        if ($this->u_error) {
            throw new FileException("File couldn't be uploaded reason " . FileException::$upload_errors[$this->u_error], Config::get('file_error'), Config::get('error_lvl_low'), __FILE__, __LINE__);
        }

        $this->_get_file_extension();

        return true;
    }
1222011
public function upload($file)
    {
        $this->filename = $this->getRandomFilename();
        $this->image = Image::make(Input::file($file)->getRealPath());

        return $this;
    }
789075
public function upload($file)
    {
        $zip = new Zip();
        $zip->addFile($file);

        $response = $this->browser->request('POST', 'file', json_encode(array('file' => base64_encode($zip->getContent()))));
        $content  = json_decode($response->getContent(), true);

        if (!isset($content['value'])) {
            throw new LibraryException('Malformed expression, no key "value" in response: '.$response->getContent());
        }

        $file = $content['value'];

        $this->type($file);

        return $file;
    }
1195335
public function fileExists($file)
    {
        return ($this->isConnected() === true) ? ftp_rmdir($this->connectionString.$file) : false;
    }
1293457
public function accept( File $file ) : bool
    {
        return $file->isFile() && $file->getExtension() === $this->extension;
    }
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;
	}
979374
public function upload($file, $type)
    {
        if (!$file || !$type) {
            $this->setError('参数缺失');

            return false;
        }

        if (!file_exists($file)) {
            $this->setError('文件路径不正确');

            return false;
        }

        $data          = [];
        $data['media'] = '@' . realpath($file);

        Api::setPostQueryStr('type', $type);

        $node = 'upload';

        $res = $this->_post($node, $data, false);

        return $res;
    }
33631
public function prepare($file)
    {
        if (request()->has(static::FILE_DELETE_FLAG)) {
            return $this->destroy();
        }

        $this->name = $this->getStoreName($file);

        return $this->uploadAndDeleteOriginal($file);
    }
221545
public function delFile($file)
    {
        $file = $this->checkpath($file);
        if (@!ftp_delete($this->linkid, $file)) {
            $this->close();
            return false;
        }
        $this->close();
        return true;
    }
885256
private function uploadFile(UploadedFile $file)
    {
        /** @var FileStorage $fileStorage */
        $fileStorage = Yii::$app->get('fileStorage');

        $filename = $fileStorage->saveUploadedFile($file);

        return $fileStorage->put($filename, $file->name);
    }
508385
public function upload($file,$path){
        if( $this->validExt($file->getClientOriginalName())){
            if($file->getClientSize() > ($this->getMaxUploadFileSize() * 1024 * 1024) ){

                $result = array("query"=>"BE_UPLOAD_FILE_SIZE_NOT_SERVER","params"=>array($file->getClientSize()));
                $this->setInfo(array("msg"=>$result));

                if( $this->config['debug'] ) $this->_log(__METHOD__." - file size no permitido server: ".$file->getClientSize());
                return ;
            }elseif($file->getClientSize() > ($this->config['upload']['size_max'] * 1024 * 1024) ){

                $result = array("query"=>"BE_UPLOAD_FILE_SIZE_NOT_PERMITIDO","params"=>array($file->getClientSize()));
                $this->setInfo(array("msg"=>$result));

                if( $this->config['debug'] ) $this->_log(__METHOD__." - file size no permitido: ".$file->getClientSize());
                return ;
            }else{
                if($file->isValid()){
                    $dir = $this->getFullPath().$path;
                    $namefile = $file->getClientOriginalName();
                    $namefile = $this->clearNameFile($namefile);
                    $nametemp = $namefile;
                    if( $this->config["upload"]["overwrite"] ==false){
                        $ext = $this->getExtension($namefile);
                        $i=0;
                        while(true){
                            $pathnametemp = $dir.$nametemp;
                            if(file_exists($pathnametemp)){
                                $i++;
                                $nametemp = $this->removeExtension( $namefile ) . '_' . $i . '.' . $ext ;
                            }else{
                                break;
                            }
                        }
                    }
                    $file->move($dir,$nametemp);
                    $file = new  \SplFileInfo($dir.$nametemp);
                    return $file;
                }
            }
        }else{
            if( $this->config['debug'] ) $this->_log(__METHOD__." - file extension no permitido: ".$file->getExtension());
        }
    }
1231665
public function checkFile($file)
    {
        $result = $this->execute(new Process([$this->getCli(), '-l', $file]));

        if (0 === $result['code']) {
            return [
                'validity' => true,
                'errors' => null
            ];
        }

        $fullMessage = \preg_replace('/ in (?:.+) on line (?:[0-9]+)$/', '', $result['output']);
        \preg_match('/ on line ([0-9]+)$/', $result['output'], $matchLine);
        $line = isset($matchLine[1]) ? \intval($matchLine[1]) : null;

        list($type, $message) = \explode(': ', $fullMessage);

        return [
            'validity' => false,
            'errors' => [
                [
                    'file' => $file,
                    'code' => $result['code'],
                    'line' => $line,
                    'type' => $type,
                    'message' => $this->convertMessage($message)
                ],
            ],
        ];
    }
1246962
public function process(File &$file, UploadedFile &$upload)
    {
        $mimeType = $upload->getClientMimeType();
        if ($mimeType == 'image/jpeg' || $mimeType == 'image/png') {
            $image = (new ImageManager())->make($upload->getRealPath());

            if ($this->settings->get('mustResize')) {
                $this->resize($image);
            }

            if ($this->settings->get('addsWatermarks')) {
                $this->watermark($image);
            }

            @file_put_contents(
                $upload->getRealPath(),
                $image->encode($upload->getClientMimeType())
            );
        }
    }
855871
public function send_file($file) {
        $this->googleoauth->setHeader("Content-Length: ". $file->get_filesize());
        $this->googleoauth->setHeader("Content-Type: ". $file->get_mimetype());
        $this->googleoauth->setHeader("Slug: ". $file->get_filename());

        $this->googleoauth->post(self::UPLOAD_LOCATION, $file->get_content());

        if ($this->googleoauth->info['http_code'] === 201) {
            return true;
        } else {
            return false;
        }
    }
1147268
public function handleSingleFile($file)
    {
        if (!$file instanceof UploadedFile) {
            throw new \Exception("Dados inválidos para upload");
        }

        $document = $this->createDocument($file);

        $this->processBeforeSave($document);

        $disk = Storage::disk()->getDriver();
        $disk->put($document->filePath, fopen($file, 'r+'), [
            'visibility' => 'public',
            'ContentType' => $document->mimeType
        ]);

        $document->url = config('filesystems.default') == 'public' ? asset('images/' . $document->filePath) : Storage::url($document->filePath);
        $document->save();

        $this->addFileToList($document);

        return $document;
    }
998445
private function uploadOne(UploadedFile $file)
    {
        try {
            $uploader = new Uploader(['config' => $this->_config]);
            $uploader->up($file);
            $fileInfo = $uploader->getFileInfo();
            $result = [
                'name' => Html::encode($file->name),
                'url' => $fileInfo['url'],
                'path' => $fileInfo['url'],
                'extension' => $file->extension,
                'type' => $file->type,
                'size' => $file->size
            ];
            if ($this->onlyImage !== true) {
                $result['filename'] = $result['name'];
            }

        } catch (Exception $e) {
            $result = [
                'error' => $e->getMessage()
            ];
        }
        return $result;
    }
264720
public function parseFile($file)
    {
        if (!file_exists($file)) {
            return false;
        }
        $fh = fopen($file, 'r');
        if (!$fh) {
            return false;
        }
        $ret = $this->parseHandle($fh);
        fclose($fh);
        return $ret;
    }