Triggers the upload process.

@return array
511816
public function upload()
    {
        $multipartStream = new Psr7\MultipartStream([
            [
                'name' => 'metadata',
                'headers' => ['Content-Type' => 'application/json; charset=UTF-8'],
                'contents' => $this->jsonEncode($this->metadata)
            ],
            [
                'name' => 'data',
                'headers' => ['Content-Type' => $this->contentType],
                'contents' => $this->data
            ]
        ], 'boundary');

        $headers = [
            'Content-Type' => 'multipart/related; boundary=boundary',
            'Content-Length' => $multipartStream->getSize()
        ];

        return $this->jsonDecode(
            $this->requestWrapper->send(
                new Request(
                    'POST',
                    $this->uri,
                    $headers,
                    $multipartStream
                ),
                $this->requestOptions
            )->getBody(),
            true
        );
    }
495766
public function info_upload()
    {
        $this->check();
        return [
            'size_upload'    => $this->response()->size_upload(),
            'upload_content' => $this->response()->upload_content_length(),
            'speed_upload'   => $this->response()->speed_upload(),
            'time_request'   => $this->response()->total_time()
        ];
    }
556329
public function uploadChunk ()
		{
			move_uploaded_file($this->_file[ 'tmp_name' ], $this->chunkPath);

			Yii::$app->response->setStatusCode(200);
		}
1022491
public function getUploadedFiles()
    {
        $files = [];

        foreach (self::normailizeUploadedFiles($this->files) as $key => $file) {
            if (isset($file['name'])) {
                $files[$key] = new UploadedFile($file);
            } else {
                foreach ($file as $f) {
                    if ('' === $f['name']) {
                        continue;
                    }

                    $files[$key][] = new UploadedFile($f);
                }
            }
        }

        return $files;
    }
629844
public function actionFileUpload() {

		$source = $this->config->getCompatibleSource($this->request->source);

		$root = $source->getRoot();
		$path = $source->getPath();

		$this->accessControl->checkPermission($this->getUserRole(), $this->action, $path);

		$messages = [];

		$files = $this->move($source);

		$isImages = [];
		$files = array_map(function (File $file) use ($source, $root, &$isImages) {
			$messages[] = 'File ' . $file->getName() . ' was uploaded';
			$isImages[] = $file->isImage();
			return str_replace($root, '', $file->getPath());
		}, $files);

		if (!count($files)) {
			throw new \Exception('No files have been uploaded', Consts::ERROR_CODE_NO_FILES_UPLOADED);
		}

		return [
			'baseurl' => $source->baseurl,
			'messages' => $messages,
			'files' => $files,
			'isImages' => $isImages
		];
	}
9043
public function actionImagesUpload()
    {
        $result = $this->actionFilesUpload();

        if ($result['upload'] && $result['file']) {
            $fileId = $result['file']->id;

            $image = Yii::$app->storage->createImage($fileId, 0);

            if ($image) {
                // create system thumbnails
                $tinyCrop = Yii::$app->storage->createImage($fileId, Yii::$app->storage->getFilterId(TinyCrop::identifier()));
                $mediumThumbnail = Yii::$app->storage->createImage($fileId, Yii::$app->storage->getFilterId(MediumThumbnail::identifier()));
            }

            return [
                'image' => $image,
                'tinyCrop' => $tinyCrop,
                'mediumThumbnail' => $mediumThumbnail,
            ];
        }

        return $this->sendArrayError(['image' => 'Unable to create the given with and the corresponding filters.']);
    }
443314
public function execute()
    {
        try {
            $result = $this->uploader->saveFileToTmpDir($this->getFieldName());

            $result['cookie'] = [
                'name' => $this->_getSession()->getName(),
                'value' => $this->_getSession()->getSessionId(),
                'lifetime' => $this->_getSession()->getCookieLifetime(),
                'path' => $this->_getSession()->getCookiePath(),
                'domain' => $this->_getSession()->getCookieDomain(),
            ];
        } catch (\Exception $e) {
            $result = ['error' => $e->getMessage(), 'errorcode' => $e->getCode()];
        }
        return $this->resultFactory->create(ResultFactory::TYPE_JSON)->setData($result);
    }
629028
private function deleteUploads()
    {
        if($this->option('deleteUploads')) {
            $this->info("Deleting uploads...");
            File::deleteDirectory(public_path('uploads'), true);
            $this->advanceBar();
        }
        return $this;
    }
275589
public function newUpload()
    {
        if (null === $this->getFile()) {
            return null;
        }

        $this->moveFile();

        return $this->getUploadRootDir() . $this->path;
    }
306407
public function getUploadedFiles()
    {
        if ($this->_uploadedFiles === null) {
            $this->getParsedBody(); // uploaded files are the part of the body and may be set while its parsing
            if ($this->_uploadedFiles === null) {
                $this->_uploadedFiles = $this->defaultUploadedFiles();
            }
        }
        return $this->_uploadedFiles;
    }
1090249
protected function defaultUploadedFiles()
    {
        $files = [];
        foreach ($_FILES as $class => $info) {
            $files[$class] = [];
            $this->populateUploadedFileRecursive($files[$class], $info['name'], $info['tmp_name'], $info['type'], $info['size'], $info['error']);
        }

        return $files;
    }
228872
public function actions()
    {
        return [
            'image-upload' => \bizley\contenttools\actions\UploadAction::class,
            'image-insert' => \bizley\contenttools\actions\InsertAction::class,
            'image-rotate' => \bizley\contenttools\actions\RotateAction::class,
        ];
    }
131641
private function prepareUpload() {
		if(!current_user_can('upload_files')) {
			json_response(["status" => "error", "message" => "Current user can't upload."]);
		}

		if (!$this->client || !$this->client->enabled()) {
			json_response(["status" => "error", "message" => "Storage settings are invalid."]);
		}

		$filename = $_POST['filename'];
		$type = $_POST['type'];

		if (empty($filename) || empty($type)) {
			json_response(["status" => "error", "message" => "Invalid file name or missing type."]);
		}

		$prefix = StorageSettings::prefix(null);
		$parts = explode('/', $filename);
		$bucketFilename = array_pop($parts);

		$uploadInfo = $this->client->uploadUrl($prefix.$bucketFilename,StorageSettings::privacy(), $type,StorageSettings::cacheControl(), StorageSettings::expires());
		$res = $uploadInfo->toArray();
		$res['status'] = 'ready';
		json_response($res);
	}
1056941
public function resolve()
    {
        $this->setFile($this->fileDomain->upload(
            $this->sourceFile
        ));
        if (!$this->name) {
            $this->setName($this->getFile()->getOriginalName());
        }

        return parent::resolve();
    }
383347
public function onLoadSetup()
    {
        $this->vars['columns'] = $this->getSetupListColumns();
        $this->vars['perPageOptions'] = $this->getSetupPerPageOptions();
        $this->vars['recordsPerPage'] = $this->recordsPerPage;
        return $this->makePartial('setup_form');
    }
419829
private function _prepareUploadData()
    {
        if (!$this->_createTargetDir()) {
            $this->_setError(PLUPLOAD_TMPDIR_ERR);
            return false;
        }
        $post = $this->_request->getPost();
        $this->_chunk = ($post->chunk) ? intval($post->chunk) : 0;
        $this->_chunks = ($post->chunks) ? intval($post->chunks) : 0;
        $this->_fileName = $post->name;
        $this->_fileId = $post->fileId;
        $this->_fileSize = $post->fileSize;
        $this->_formObject = $post->formObject;
        $this->_formObjectId = ($post->formObjectId) ? $post->formObjectId : null;
        $this->_cmsFileId = ($post->cmsFileId > 0) ? $post->cmsFileId : null;
        $this->_filters = ($post->filters) ? $post->filters : [];
        if (!$this->_fileName || !$this->_fileId || !$this->_fileSize || !$this->_formObject) {
            $this->_setError(PLUPLOAD_INPUT_ERR, "Błąd: niekompletne parametry żądania");
            return false;
        }
        $this->_filePath = $this->_targetDir . $this->_fileId;
        if (strrpos($this->_fileName, '.') > 0) {
            $this->_filePath .= substr($this->_fileName, strrpos($this->_fileName, '.'));
        }
        $this->_filePathPart = $this->_filePath . '.part';
        $this->_contentType = $this->_request->getContentType();
        return true;
    }
612983
public function getInput()
    {
        $data = $this->getRequest()->getParsedBody();
        
        if (is_array($data)) {
            $files = $this->getRequest()->getUploadedFiles();
            $data = array_replace_recursive($data, (array)$files);
        }
        
        return $data;
    }