Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
eZHTTPFile Class Reference
Utility classes » HTTP utilities

Provides access to HTTP post files. More...

## Public Member Functions
| __construct ($http_name, $variable)
| storageDir ( $sub_dir=false)
| store ( $sub_dir=false, $suffix=false, $mimeData=false)
| attributes ()
| hasAttribute ( $attr)
| attribute ( $attr)
| setMimeType ( $mime)

## Static Public Member Functions
static | canFetch ( $httpName, $maxSize=false)
static | fetch ( $http_name)

## Public Attributes
const | UPLOADEDFILE_OK = 0
const | UPLOADEDFILE_DOES_NOT_EXIST = -1
const | UPLOADEDFILE_EXCEEDS_PHP_LIMIT = -2
const | UPLOADEDFILE_EXCEEDS_MAX_SIZE = -3
const | UPLOADEDFILE_MISSING_TMP_DIR = -4
const | UPLOADEDFILE_CANT_WRITE = -5
const | UPLOADEDFILE_UNKNOWN_ERROR = -6
| $HTTPName
| The name of the HTTP file. More...
| $OriginalFilename
| The original name of the file from the client. More...
| $Type
| The mime type of the file. More...
| $MimeCategory
| The mimetype category (first part) More...
| $MimePart
| The mimetype type (second part) More...
| $Filename
| The local filename. More...
| $Size
| The size of the local file. More...
| $IsTemporary
| Whether the file is a temporary file or if it has been moved(stored). More...

## Detailed Description

Provides access to HTTP post files.

This class provides easy access to files posted by clients over HTTP. The HTTP file will be present as a temporary file which can be moved to store it, if not the file will be removed when the PHP script is done.

Definition at line 22 of file ezhttpfile.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZHTTPFile::__construct | ( |  | $http_name,
|  |  | $variable
| ) |  |

Initializes with a name and http variable.

Parameters

  $http_name | Name of the HTTP variable
  $variable | The HTTP variable structure

Definition at line 35 of file ezhttpfile.php.

## Member Function Documentation

## ◆ attribute()

eZHTTPFile::attribute | ( |  | $attr | ) |

Returns
  the value for the attribute $attr or null if the attribute does not exist.

Definition at line 159 of file ezhttpfile.php.

References $Filename, $IsTemporary, $MimeCategory, $MimePart, $OriginalFilename, $Size, $Type, and eZDebug\writeError().

## ◆ attributes()

eZHTTPFile::attributes | ( |  | ) |

Returns
  an array with the attributes for this object.

Definition at line 137 of file ezhttpfile.php.

Referenced by hasAttribute().

## ◆ canFetch()

static eZHTTPFile::canFetch | ( |  | $httpName,
|  |  | $maxSize = `false`
| ) |  |
| static

Returns whether a file can be fetched.

Parameters

  string | $httpName | Name of the file.
  | bool|int | Whether a maximum file size applies or size in bytes of the maximum allowed.

Returns
  bool|int true if the HTTP file $httpName can be fetched. If $maxSize is given, the function returns eZHTTPFile::UPLOADEDFILE_OK if the file can be fetched, eZHTTPFile::UPLOADEDFILE_DOES_NOT_EXIST if there has been no file uploaded, eZHTTPFile::UPLOADEDFILE_EXCEEDS_PHP_LIMIT if the file was uploaded but size exceeds the upload_max_size limit (set in the PHP configuration), eZHTTPFile::UPLOADEDFILE_EXCEEDS_MAX_SIZE if the file was uploaded but size exceeds $maxSize or MAX_FILE_SIZE variable in the form. eZHTTPFile::UPLOADEDFILE_MISSING_TMP_DIR if the temporary directory is missing eZHTTPFile::UPLOADEDFILE_CANT_WRITE if the file can't be written eZHTTPFile::UPLOADEDFILE_UNKNOWN_ERROR if an unknown error occured

Definition at line 203 of file ezhttpfile.php.

References UPLOADEDFILE_CANT_WRITE, UPLOADEDFILE_DOES_NOT_EXIST, UPLOADEDFILE_EXCEEDS_MAX_SIZE, UPLOADEDFILE_EXCEEDS_PHP_LIMIT, UPLOADEDFILE_MISSING_TMP_DIR, UPLOADEDFILE_OK, and UPLOADEDFILE_UNKNOWN_ERROR.

Referenced by eZContentUpload\fetchHTTPFile(), eZBinaryFileType\fetchObjectAttributeHTTPInput(), eZImageType\fetchObjectAttributeHTTPInput(), eZMediaType\fetchObjectAttributeHTTPInput(), eZStylePackageCreator\validateCSSFile(), eZStylePackageCreator\validateImageFiles(), eZBinaryFileType\validateObjectAttributeHTTPInput(), eZImageType\validateObjectAttributeHTTPInput(), eZMediaType\validateObjectAttributeHTTPInput(), and eZPackageCreationHandler\validatePackageThumbnail().

## ◆ fetch()

static eZHTTPFile::fetch | ( |  | $http_name | ) |
| static

Fetches the HTTP file named $http_name and returns a eZHTTPFile object, or null if the file could not be fetched.

Definition at line 269 of file ezhttpfile.php.

References eZMimeType\findByURL(), and eZDebug\writeError().

Referenced by eZStylePackageCreator\commitCSSFile(), eZContentUpload\fetchHTTPFile(), eZBinaryFileType\fetchObjectAttributeHTTPInput(), eZImageType\fetchObjectAttributeHTTPInput(), eZMediaType\fetchObjectAttributeHTTPInput(), eZStylePackageCreator\validateCSSFile(), eZStylePackageCreator\validateImageFiles(), and eZPackageCreationHandler\validatePackageThumbnail().

## ◆ hasAttribute()

eZHTTPFile::hasAttribute | ( |  | $attr | ) |

Returns
  true if the attribute $attr exists

Definition at line 151 of file ezhttpfile.php.

References attributes().

## ◆ setMimeType()

eZHTTPFile::setMimeType | ( |  | $mime | ) |

Changes the MIME-Type to $mime.

Definition at line 295 of file ezhttpfile.php.

## ◆ storageDir()

eZHTTPFile::storageDir | ( |  | $sub_dir = `false` | ) |

Returns
  the directory where the file should be stored.

Definition at line 52 of file ezhttpfile.php.

References $MimeCategory, and eZSys\instance().

## ◆ store()

eZHTTPFile::store | ( |  | $sub_dir = `false`,
|  |  | $suffix = `false`,
|  |  | $mimeData = `false`
| ) |  |

Stores the temporary file to the destination dir $dir.

Definition at line 66 of file ezhttpfile.php.

References $MimeCategory, eZDir\mkdir(), eZSys\storageDirectory(), eZDebug\writeError(), and eZLog\writeStorageLog().

## Member Data Documentation

## ◆ $Filename

eZHTTPFile::$Filename

The local filename.

Definition at line 312 of file ezhttpfile.php.

Referenced by attribute().

## ◆ $HTTPName

eZHTTPFile::$HTTPName

The name of the HTTP file.

Definition at line 302 of file ezhttpfile.php.

## ◆ $IsTemporary

eZHTTPFile::$IsTemporary

Whether the file is a temporary file or if it has been moved(stored).

Definition at line 316 of file ezhttpfile.php.

Referenced by attribute().

## ◆ $MimeCategory

eZHTTPFile::$MimeCategory

The mimetype category (first part)

Definition at line 308 of file ezhttpfile.php.

Referenced by attribute(), storageDir(), and store().

## ◆ $MimePart

eZHTTPFile::$MimePart

The mimetype type (second part)

Definition at line 310 of file ezhttpfile.php.

Referenced by attribute().

## ◆ $OriginalFilename

eZHTTPFile::$OriginalFilename

The original name of the file from the client.

Definition at line 304 of file ezhttpfile.php.

Referenced by attribute().

## ◆ $Size

eZHTTPFile::$Size

The size of the local file.

Definition at line 314 of file ezhttpfile.php.

Referenced by attribute().

## ◆ $Type

eZHTTPFile::$Type

The mime type of the file.

Definition at line 306 of file ezhttpfile.php.

Referenced by attribute().

## ◆ UPLOADEDFILE_CANT_WRITE

const eZHTTPFile::UPLOADEDFILE_CANT_WRITE = -5

Definition at line 29 of file ezhttpfile.php.

Referenced by canFetch(), and eZContentUpload\fetchHTTPFile().

## ◆ UPLOADEDFILE_DOES_NOT_EXIST

const eZHTTPFile::UPLOADEDFILE_DOES_NOT_EXIST = -1

Definition at line 25 of file ezhttpfile.php.

Referenced by canFetch(), eZContentUpload\fetchHTTPFile(), eZBinaryFileType\validateObjectAttributeHTTPInput(), eZImageType\validateObjectAttributeHTTPInput(), and eZMediaType\validateObjectAttributeHTTPInput().

## ◆ UPLOADEDFILE_EXCEEDS_MAX_SIZE

const eZHTTPFile::UPLOADEDFILE_EXCEEDS_MAX_SIZE = -3

Definition at line 27 of file ezhttpfile.php.

Referenced by canFetch(), eZContentUpload\fetchHTTPFile(), eZBinaryFileType\validateObjectAttributeHTTPInput(), eZImageType\validateObjectAttributeHTTPInput(), and eZMediaType\validateObjectAttributeHTTPInput().

## ◆ UPLOADEDFILE_EXCEEDS_PHP_LIMIT

const eZHTTPFile::UPLOADEDFILE_EXCEEDS_PHP_LIMIT = -2

Definition at line 26 of file ezhttpfile.php.

Referenced by canFetch(), eZContentUpload\fetchHTTPFile(), eZBinaryFileType\validateObjectAttributeHTTPInput(), eZImageType\validateObjectAttributeHTTPInput(), and eZMediaType\validateObjectAttributeHTTPInput().

## ◆ UPLOADEDFILE_MISSING_TMP_DIR

const eZHTTPFile::UPLOADEDFILE_MISSING_TMP_DIR = -4

Definition at line 28 of file ezhttpfile.php.

Referenced by canFetch(), and eZContentUpload\fetchHTTPFile().

## ◆ UPLOADEDFILE_OK

const eZHTTPFile::UPLOADEDFILE_OK = 0

Definition at line 24 of file ezhttpfile.php.

Referenced by canFetch(), and eZContentUpload\fetchHTTPFile().

## ◆ UPLOADEDFILE_UNKNOWN_ERROR

const eZHTTPFile::UPLOADEDFILE_UNKNOWN_ERROR = -6

Definition at line 30 of file ezhttpfile.php.

Referenced by canFetch(), and eZContentUpload\fetchHTTPFile().

The documentation for this class was generated from the following file:

- ezhttpfile.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.