Sets the uploaded file.

@param UploadedFile|null $file
490643
public function setFileUpload(UploadedFile $file = null)
    {
        $propertyName = $this->getFileUploadPropertyName(__FUNCTION__);

        unset($this->fileUploads[$propertyName]);
        if ($file instanceof UploadedFile) {
            $this->fileUploads[$propertyName] = $file;
        }
    }
1064552
public function uploadImage(UploadedFile $file)
    {
        $image = $this
            ->imageManager
            ->createImage($file);

        $this
            ->mediaEventDispatcher
            ->dispatchImagePreUploadEvent($image);

        $this->imageObjectManager->persist($image);
        $this->imageObjectManager->flush($image);

        $this->fileManager->uploadFile(
            $image,
            file_get_contents($file->getRealPath()),
            true
        );

        $this
            ->mediaEventDispatcher
            ->dispatchImageOnUploadEvent($image);

        return $image;
    }
1054408
public function setFile($file)
    {
        if (is_string($file)) {
            $file = new PhingFile($file);
        }
        $this->file = $file;
    }
490473
public function upload($file, $to = null)
    {
        if ($this->test($file)) {
            if (null === $to) {
                $to = $file['name'];
            }
            if (!$this->overwrite) {
                $to = $this->checkFilename($to);
            }

            $this->uploadedFile = $to;
            $to = $this->uploadDir . DIRECTORY_SEPARATOR . $to;

            // Move the uploaded file, creating a file object with it.
            if (move_uploaded_file($file['tmp_name'], $to)) {
                return $this->uploadedFile;
            } else {
                $this->error = self::UPLOAD_ERR_UNEXPECTED;
                return false;
            }
        } else {
            return false;
        }

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

        if (!is_null($this->storage_permission)) {
            return $this->storage->putFileAs($this->getDirectory(), $file, $this->name, $this->storage_permission);
        }

        return $this->storage->putFileAs($this->getDirectory(), $file, $this->name);
    }
381692
def set_uploading(self, files_uploaded):
        
        self.files_uploaded = files_uploaded
        self.__record_progress(Status.UPLOADING_FILES)
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;
        });
    }
1185898
protected function setUploadedFiles(array &$files)
    {
        $isUploadedFiles = ($files === $_FILES);
        
        $this->files =& $files;
        $this->uploadedFiles = $this->groupUploadedFiles($files, null, $isUploadedFiles);
    }
764625
public function upload($file, $destination = null)
    {
        if (!file_exists($file)) {
            return;
        }

        // Get contents and destination
        $destination = $destination ?: basename($file);

        $this->put($destination, file_get_contents($file));
    }
779666
public void setFile(File file) throws FileNotFoundException{
		this.setInputStream(new BufferedInputStream(new FileInputStream(file)), file.length());
		this.isUploadFile = true;
	}
858738
public function delete($file = null)
	{
		$file = $file ?: $this->file;
		if ($this->fs->exists($file))
			$this->fs->delete($file);
		if ($this->f3->get('CACHE')) {
			$cache = \Cache::instance();
			if($cache->exists($cacheHash = $this->getCacheHash($file)))
				$cache->clear($cacheHash);
		}
		$this->metaHandle->delete($file);
	}
957777
public static function process($file = NULL){

        $exists = isset( self::$data[ self::$level ] );

        if( $exists ){
            $variables = self::$data[ self::$level ];

            foreach( $variables as $key => $value ){
                global $$key;
                $$key = $value;
            }
        }

        if( $file ){
            require $file;
        }

    }
221395
public function add_stored_file($file) {
        if (is_numeric($file)) {
            $this->files[$file] = $file;
        } else {
            $this->files[$file->get_id()] = $file;
        }
    }
26321
public function setFile(\Lexik\Bundle\TranslationBundle\Model\File $file)
    {
        $this->file = $file;
    }
606829
public function setFile($file): self
    {
        $this->file = $file;

        if (is_string($file)) {
            $this->pathToFile = $file;
            $this->setFileName(pathinfo($file, PATHINFO_BASENAME));
            $this->mediaName = pathinfo($file, PATHINFO_FILENAME);

            return $this;
        }

        if ($file instanceof UploadedFile) {
            $this->pathToFile = $file->getPath().'/'.$file->getFilename();
            $this->setFileName($file->getClientOriginalName());
            $this->mediaName = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME);

            return $this;
        }

        if ($file instanceof SymfonyFile) {
            $this->pathToFile = $file->getPath().'/'.$file->getFilename();
            $this->setFileName(pathinfo($file->getFilename(), PATHINFO_BASENAME));
            $this->mediaName = pathinfo($file->getFilename(), PATHINFO_FILENAME);

            return $this;
        }

        throw UnknownType::create();
    }
159211
private function doRequestUpload(UploadedFile $file)
    {
        $tmpDirectory = $this->getApplication()->getTemporaryDir();
        $data = [];

        if (null !== $file) {
            if ($file->isValid()) {
                if ($file->getClientSize() <= $file->getMaxFilesize()) {
                    $data = $this->buildData($file->getClientOriginalName(), $file->guessExtension());
                    $file->move($tmpDirectory, $data['filename']);
                    $data['size'] = round($file->getClientSize() / 1024, 2);
                    if ($imageInfo = @getimagesize( $data['path'])) {
                        if (isset($imageInfo[0]) && isset($imageInfo[1])) {
                            $data['width'] = $imageInfo[0];
                            $data['height'] = $imageInfo[1];
                        }
                    } else {
                        $data['width'] = 0;
                        $data['height'] = 0;
                    }
                } else {
                    throw new BadRequestHttpException('Too big file, the max file size is ' . $file->getMaxFilesize());
                }
            } else {
                throw new BadRequestHttpException($file->getErrorMessage());
            }
        }

        return $data;
    }
1125686
public function setFiles($files)
    {
        $this->_files = array();
        $token        = ' ,;';
        $file         = strtok($files, $token);

        while ($file !== false) {
            $this->_files[] = $file;
            $file           = strtok($token);
        }

    }