Sets a file to be uploaded.

@param string $filename Filename.

@return self
@throws FileInputException When file could not be found on disk.
430137
public function setFileToUpload($filename)
	{
		if ( !file_exists($filename) ) {
			throw new FileInputException(
				'File "' . $filename . '" doesn\'t exist',
				FileInputException::TYPE_FILE_NOT_FOUND
			);
		}

		$this->getWrappedElement()->attachFile($filename);

		return $this;
	}
940470
public function setDisposition(string $dispositionType, $filename = null, $name = null)
    {
        if (!in_array($dispositionType, $this->dispositions)) {
            Checkers::notice('Unknown response type [' . $type . ']');
        } else {
            $this->disposition['type'] = $dispositionType;
        }
        if ($filename !== null) {
            $this->disposition['filename'] = (string) $filename;
        }
        if ($name !== null) {
            $this->disposition['name'] = (string) $name;
        }
        return $this;
    }
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();
    }
210672
public function set($filename)
    {
        $this->image = null;
        $this->filename = $filename;

        $info = getimagesize($this->filename);

        if (empty($info)) {
            throw new UnexpectedValueException('Failed to get image dimensions');
        }

        $this->width = $info[0];
        $this->height = $info[1];
        $this->format = preg_replace('/^image\//', '', $info['mime']);
        $this->image = $this->callFunction('imagecreatefrom', $this->format, array($this->filename));

        if (!is_resource($this->image)) {
            throw new UnexpectedValueException('Image file handle is not a valid resource');
        }

        imagesavealpha($this->image, true);
        imagealphablending($this->image, true);

        return $this;
    }
287704
public function addFile($fileName)
    {
        $this->files[$fileName] = sha1_file($fileName);

        $reflection = new FileReflector($fileName, true);
        $reflection->process();

        foreach ($reflection->getClasses() as $class) {
            $class = new ClassDoc($class, $this, ['sourceFile' => $fileName]);
            $this->classes[$class->name] = $class;
        }
        foreach ($reflection->getInterfaces() as $interface) {
            $interface = new InterfaceDoc($interface, $this, ['sourceFile' => $fileName]);
            $this->interfaces[$interface->name] = $interface;
        }
        foreach ($reflection->getTraits() as $trait) {
            $trait = new TraitDoc($trait, $this, ['sourceFile' => $fileName]);
            $this->traits[$trait->name] = $trait;
        }
    }
593415
public function setName($name)
	{
		if ( ! is_string($name)) {
			throw new \InvalidArgumentException(
				__METHOD__."() expects parameter one, name, to be a string"
			);	
		}
		
		if ( ! is_readable($name)) {
			throw new \InvalidArgumentException(
				__METHOD__."() expects parameter one, name, to be a readable filename"
			);
		}
		
		$this->name = $name;
		
		return $this;
	}
301779
public function save($filename)
    {
        $this->setFilename($filename);

        call_user_func_array($this->getFunctionName(), [$this->getImage(), $filename]);

        return $filename;
    }
104422
protected function validateFilePath($fileName) {
		if (!file_exists($fileName)) {
			throw new IOException("File $fileName does not exists");
		}
		if (!is_file($fileName)) {
			throw new IOException("$fileName must be a file");
		}
		if (!is_readable($fileName)) {
			throw new IOException("File $fileName is not readable");
		}
		return true;
	}
1915
public function save($fileName = null)
	{
		file_put_contents(empty($fileName) ? $this->fileName : $fileName, json_encode($this->data), LOCK_EX);
	}
958619
public function setSourceFile($filename)
    {
        if ($filename instanceof Pdf) {
            return parent::setSourceFile($filename->currentFilename);
        } else {
            return parent::setSourceFile($filename);
        }
        // FIX: tried to be more efficiend but using same parsers brings issues clonning too.
        $newPdf = $filename;
        $this->currentFilename =  $newPdf->currentFilename;

        $this->parsers[$newPdf->currentFilename] = $newPdf->parsers[$newPdf->currentFilename];
        $this->setPdfVersion(
            max($this->getPdfVersion(), $newPdf->currentParser->getPdfVersion())
        );
        $this->currentParser = $this->parsers[$newPdf->currentFilename];
        return $this->currentParser->getPageCount();
    }
526158
public function setType(string $filename, $type = null): AssetFileInterface
    {
        if (! is_null($type) && in_array($type, $this->extensions, true)) {
            // We first listen to a defined asset type.
            // If no type is defined, let's try to discover it.
            $this->type = $this->findType($type);

            return $this;
        }

        $ext = $this->files->extension($filename);

        if (! empty($ext) && in_array($ext, $this->extensions, true)) {
            $this->type = $this->findType($ext);
        }

        return $this;
    }
249683
public function save($filename)
    {
        $this->setupSpreadsheet();

        $this->setupHeader();

        $this->setupBody();


        $extension = pathinfo($filename, PATHINFO_EXTENSION);

        $writer = null;
        foreach($this->writers as $slug => $base) {

            if (Str::lower($extension) == $slug && $slug == 'pdf') {

                IOFactory::registerWriter('CustomPDF', PDFWriter::class);
                $writer = IOFactory::createWriter($this->getSpreadsheetObject(), 'CustomPDF');
                $writer->save($filename);

            } elseif (Str::lower($extension) == $slug) {

                $writer = IOFactory::createWriter($this->getSpreadsheetObject(), $base);
                $writer->save($filename);
            }
        }

        if ($writer == null) {
            throw new \InvalidArgumentException(
                "Unsupported file type for writing. Use " . implode(',', self::$instance->writers));
        }

        return $this;
    }
278916
public function setLocalFile(string $filename): void
    {
        if (empty($filename)) {
            throw new Exception('the filename can not be empty', Exception::LOCAL_FILE_MISSING);
        }

        $this->localFile = $filename;
        $this->loader    = null;
    }
649596
public function setFileName($fileName)
	{
		$hasFilename = ($this->fileName !== null);
		
		if ($hasFilename) {
			$previousName = $this->fileName;
			$previousExtension = $this->getExtension();
		}
		
		parent::setFileName($fileName);
		
		if ($hasFilename) {
			
			$newExtension = $this->getExtension();

			if (strcasecmp($previousExtension, $newExtension) !== 0) {

				// restore name back to previous one. Because that's safer.
				parent::setFileName($previousName);

				throw new \RuntimeException('Extension change is not allowed');
			}
		}
	}
780005
public function save($fileName = null)
	{
		file_put_contents(empty($fileName) ? $this->fileName : $fileName, XML::toString($this->data), LOCK_EX);
	}
483403
public function setFile($file = null)
    {
        if ($file instanceof UploadedFile) {
            $this->file = base64_encode(file_get_contents($file));
        } else {
            $this->file = $file;
        }

        return $this;
    }
251340
public function setFileName( $fileName ){
		$this->fileName	= $fileName;
		$this->sheet	= self::load( $fileName );
	}