{@inheritdoc}

@param null|\Symfony\Component\HttpFoundation\File\UploadedFile $data
17597
public function convertFieldValueFromForm($data)
    {
        if ($data === null) {
            return null;
        }

        $imageData = array(
            'inputUri' => $data->getRealPath(),
            'fileName' => $data->getClientOriginalName(),
            'fileSize' => $data->getSize(),
        );

        return new ImageValue($imageData);
    }
50054
public function upload(UploadedFile $uploadedFile, $id = null)
    {
        if ($this->validatesUploadedFile())
        {
            $this->validateUploadedFile($uploadedFile);
        }

        return $this->processUpload($uploadedFile, $id);
    }
1312036
protected function storeAsImage(UploadedFile $file, array $data)
    {
        // Store uploaded image, to work it.
        $this->storeAsFile($file, $data);

        // Prepare local variables.
        $properties = [];
        $disk = $this->storageDisk($data['disk']);
        $path_prefix = $data['type'].DS.$data['category'].DS;
        $path_suffix = DS.$data['name'].'.'.$data['extension'];
        $quality = setting('files.images_quality', 75);
        $is_convert = setting('files.images_is_convert', true);

        // Resave original file.
        $image = $this->imageResave(
            $this->getAbsolutePathAttribute(),
            $disk->path($path_prefix.trim($path_suffix, DS)),
            setting('files.images_max_width', 3840),
            setting('files.images_max_height', 2160),
            $quality, $is_convert
        );

        if ($image) {
            // If extension has changed, then delete original file.
            if ($data['extension'] != $image['extension']) {
                $disk->delete($this->path);
            }

            // Revision attributes.
            $this->attributes['mime_type'] = $image['mime_type'];
            $this->attributes['extension'] = $image['extension'];
            $this->attributes['filesize'] = $image['filesize'];
            $properties = [
                'width' => $image['width'],
                'height' => $image['height'],
            ];

            $path_suffix = DS.$data['name'].'.'.$image['extension'];
        }

        // Cutting images.
        foreach ($this->thumbSizes() as $key => $value) {
            @$disk->makeDirectory($path_prefix.$key);
            $image = $this->imageResave(
                $this->getAbsolutePathAttribute(),
                $disk->path($path_prefix.$key.$path_suffix),
                setting('files.images_'.$key.'_width', $value),
                setting('files.images_'.$key.'_height', $value),
                $quality, $is_convert
            );

            if (! $image) break;

            // Add to options.
            $properties += [
                $key => [
                    'width' => $image['width'],
                    'height' => $image['height'],
                    'filesize' => $image['filesize'],
                ]
            ];
        }

        return $this->setAttribute('properties', $properties);
    }
1015881
protected function prepareForeach(UploadedFile $file = null)
    {
        $self       = clone $this;
        $self->name = $self->getStoreName($file);

        return tap($self->upload($file), function () use ($self) {
            $self->name = null;
        });
    }
863450
public function set_data( $data ) {

		$this->instance = 0;
		foreach ( (array) $data[ $this->slug ] as $instance => $instance_data ) {
			foreach ( $this->child as $child ) {
				if ( method_exists( $child, 'set_data' ) ) {
					$child->set_data( $instance_data );
				}
			}
			$this->instance ++;
		}
		$this->instances = $this->instance;
		$this->instance  = 0;

	}
1055252
protected function upload(UploadedFile $file)
    {
        $this->renameIfExists($file);

        return $this->storage->putFileAs($this->getDirectory(), $file, $this->name);
    }
509014
function put($data)
    {
        if ($this->_change == self::STATE_INSERT)
        {
            $this->_change = self::STATE_UPDATE;
            $this->_update = $data;
        }
        elseif ($this->_change == self::STATE_EMPTY)
        {
            $this->_change = self::STATE_INSERT;
            $this->_data = $data;
        }
    }
330470
public function write($file, $data)
    {
        $file = '/data/' . $file;

        /**
         * @todo validate that $file is a string
         * @todo validate that $data is a string
         */

        $data = json_decode(json_encode($data), true);

        $data_content = isset($data['content']) ? $data['content'] : '';

        unset($data['content']);

        $data = '---' . PHP_EOL . trim($this->yaml->dump($data, 5)) . PHP_EOL . '---' . PHP_EOL . $data_content;

        $this->source_filesystem->createDir(dirname($file));

        $this->source_filesystem->put($file, $data);
    }
938045
public function setUploadedFile($uploadedFile)
	{
		$this->clear();

		if ($uploadedFile == LARACLIP_NULL) {
			return;
		}

		$this->uploadedFile = $this->IOWrapper->make($uploadedFile);
		$this->instanceWrite('file_name', $this->uploadedFile->getFilename());
		$this->instanceWrite('file_size', $this->uploadedFile->getSize());
		$this->instanceWrite('content_type', $this->uploadedFile->getMimeType());
		$this->instanceWrite('updated_at', date('Y-m-d H:i:s'));
		$this->queueAllForWrite();
	}
49452
public function unserialize(/* mixed */ $data): void 
    {
        $values = unserialize($data);
        foreach ($values as $key=>$value) {
                $this->$key = $value;
        }
    }
1243683
public function post($url, $data = [], $params = null)
    {
        foreach ($data as $val) {
            if ($val instanceof UploadFile) {
                $params['contentType'] = 'multipart/form-data';
            }
        }
        if (!isset($params['contentType'])) {
            $params['contentType'] = 'application/x-www-form-urlencoded';
        }
        if ($params['contentType'] === 'application/x-www-form-urlencoded') {
            $body = http_build_query($data, '', '&', PHP_QUERY_RFC3986);
        } elseif ($params['contentType'] === 'application/x-json' || $params['contentType'] === 'application/json') {
            $body = json_encode($data);
        } else {
            $body = 'Unsupported Content-Type';
        }
        if (!isset($params['headers'])) {
            $params['headers'] = [];
        }
        $params['headers']['Content-Length'] = mb_orig_strlen($body);
        $this->sendRequestHeaders('POST', $url, $params);
        $this->write($body);
        $this->writeln('');
    }
1374919
public function populate($data = array())
    {
        if (isset($data['name']) && $data['name'] !== null) {
            $this->name = $data['name'];
        }

        if (isset($data['type']) && $data['type'] !== null) {
            $this->type = $data['type'];
        }
    }
94806
protected function prepareForeach(UploadedFile $image = null)
    {
        $this->name = $this->getStoreName($image);

        $this->callInterventionMethods($image->getRealPath());

        return tap($this->upload($image), function () {
            $this->name = null;
        });
    }
416585
protected final function validateNewData(array $data = null) {
		if ($data === null && isset($this->_formData)) {
			$data = $this->_formData;
		}
		if ($this->rules) {
			return $this->validateData($this->rules, $data);
		}

		return true;
	}
1370843
public function writeFile(string $filename, string $data, int $mode = null) : void
    {
        if ($mode === null) {
            $mode = 0600;
        }
        /** @psalm-suppress UndefinedClass */
        System::writeFile($filename, $data, $mode);
    }
1278850
public function doPostRequest($uri, $data = null)
    {
        return $this->doRequest(Request::POST, $uri, $data);
    }
1197225
protected function updateEntity($data)
    {
        if (!$data instanceof DataInterface) {
            return;
        }
        $family = $data->getFamily();

        if (!array_key_exists($data->getFamilyCode(), $this->familyMap)) {
            return;
        }
        $resource = $data->get($this->familyMap[$data->getFamilyCode()]);
        if (!$resource instanceof Document) {
            // Maybe we should reset the values to null
            return;
        }
        $data->setFileSize($resource->getFileSize());
        $this->valuesToPersist[] = $data->getValue($family->getAttribute('fileSize'));

        $data->setMimeType($resource->getMimeType());
        $this->valuesToPersist[] = $data->getValue($family->getAttribute('mimeType'));

        $data->setFileName($resource->getOriginalFileName());
        $this->valuesToPersist[] = $data->getValue($family->getAttribute('fileName'));
    }