com\setasign\SetaFramework\FileSystem

UnsavedFile Class UnsavedFile

File: /SetaFramework/src/FileSystem/UnsavedFile.php

This class represents a file within the memory. The file can but doesn't have to exist in the filesystem.

Class hierarchy

Implements

Summary

Properties

$contentType

protected string UnsavedFile::$contentType

$fileContent

protected string|resource|\Psr\Http\Message\StreamInterface UnsavedFile::$fileContent

$fileName

protected string UnsavedFile::$fileName

Static Methods

createByDataUrl()

public static UnsavedFile::createByDataUrl (
string $url,
string $fileName
): UnsavedFile
Parameters
$url : string
 
$fileName : string
 

createByUploadedFile()

public static UnsavedFile::createByUploadedFile (
\Psr\Http\Message\UploadedFileInterface $uploadedFile,
bool $readStream = false
): UnsavedFile
Parameters
$uploadedFile : \Psr\Http\Message\UploadedFileInterface
 
$readStream : bool

If true, the stream of the uploaded file will be read completly (memory intensive).

Exceptions

Throws \com\setasign\SetaFramework\Request\UploadException


Methods

__construct()

public UnsavedFile::__construct (
string $fileName,
string $contentType,
string|resource|\Psr\Http\Message\StreamInterface $fileContent
)

UnsavedFile constructor.

Parameters
$fileName : string
 
$contentType : string
 
$fileContent : string|resource|\Psr\Http\Message\StreamInterface
 

__sleep()

public UnsavedFile::__sleep (
void
): array

getContentType()

public UnsavedFile::getContentType (
void
): string

Get the content type.

getFileContent()

public UnsavedFile::getFileContent (
void
): string|\Psr\Http\Message\StreamInterface|resource|FilePath

getFileContentAsString()

public UnsavedFile::getFileContentAsString (
void
): string

getFileName()

public UnsavedFile::getFileName (
void
): string

Get the file name

getFileSize()

public UnsavedFile::getFileSize (
void
): int

withFileName()

public UnsavedFile::withFileName (
string $newFileName
): File

Returns a new instance of the file with another file name.

Parameters
$newFileName : string