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" );
|