App Engine PHP SDK  v1 rev.445
The PHP runtime is available as an experimental Preview feature.
Static Public Member Functions | Public Attributes | List of all members
google\appengine\runtime\UnlinkUploads Class Reference

Static Public Member Functions

static shutdownHook (array $files)
 
static removeEmptyFiles (array &$files)
 

Public Attributes

const NAME_UNLINK = '__UNLINK__'
 

Detailed Description

Handles removing (unlink()) uploaded files that are left at tmp_name.

The shutdown hook is registered in Setup.php if $_FILES is not empty. Users are expected to use move_uploaded_file() to place wanted files in proper location.

If changes are made to the $_FILES array the shutdown hook will have an unmodified copy which both prevents tampering and allows empty files to be removed along with others after removeEmptyFiles() cleans the array.

GCS creates empty files when a POST request is sent with empty file fields. Typically PHP would ignore the file fields signified using UPLOAD_ERR_NO_FILE in the $_FILES array entry. Instead rfc1867.c is modified to pass the entries along with UNLINK as the file name to ensure the tmp_name is filled with gs:// address and can be unlinked along with any unprocessed uploads.

Member Function Documentation

static google\appengine\runtime\UnlinkUploads::removeEmptyFiles ( array &  $files)
static

Remove empty file entries signified by UNLINK from array.

Parameters
array$filesAssociative array of uploaded files ($_FILES).
static google\appengine\runtime\UnlinkUploads::shutdownHook ( array  $files)
static

Remove any left over uploads.

Parameters
array$filesAssociative array of uploaded files ($_FILES).

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