Skip to content

UploadedFile: __construct Example

Terry L edited this page Jun 20, 2020 · 2 revisions

Shieldon\Psr7\UploadedFile

__construct

  • param string|StreamInterface source * The full path of a file or stream.
  • param string|null name = null The file name.
  • param string|null type = null The file media type.
  • param int|null size = null The file size in bytes.
  • param int error = 0 The status code of the upload.
  • param string|null sapi = null Only assign for unit testing purpose.

Example:

$uploadedFile = new \Shieldon\Psr7\UploadedFile(
    '/tmp/php200A.tmp', // source
    'example1.jpg',     // name
    'image/jpeg',       // type
    100000,             // size
    0                   // error
);
Clone this wiki locally