📚 Looking for current Exponential documentation? This site contains legacy SDK & API reference docs (eZ Publish era). For up-to-date 2026 product documentation, visit doc.exponential.earth.

  ezutils / http_files  

<< Fetching variables  Object persistence >> 

Fetching files

Files that are posted by clients are normally accessed by using the global _FILE variable. Each posted file has a name which is defined in the HTML form, you access the file with that name, and get a eZHTTPFile object if the file exists.

The HTML form

<form type="post">
<input type="file" name="MyFile" />
</form>

The code

if ( eZHTTPFile::canFetch( "MyFile" ) )
    $file =& eZHTTPFile::fetch( "MyFile" );

Storing the file

If we want to keep the file we must store it, or else the file will be removed when the script ends. We store it by calling the store() function on the object.

// Store file in storage
$file->store();
// or in a subdir
$file->store( "myfiles" );

Exponential Copyright © 1998 - 2026 7x