This class represents a physical file. More...
Public Member Functions | |
| __construct ($guid=null) | |
| Construct a new object entity, optionally from a given id value. | |
| setFilename ($name) | |
| Set the filename of this file. | |
| getFilename () | |
| Return the filename. | |
| getFilenameOnFilestore () | |
| Return the filename of this file as it is/will be stored on the filestore, which may be different to the filename. | |
| getFilestoreSize ($prefix='', $container_guid=0) | |
| getMimeType () | |
| Get the mime type of the file. | |
| setMimeType ($mimetype) | |
| Set the mime type of the file. | |
| setDescription ($description) | |
| Set the optional file description. | |
| open ($mode) | |
| Open the file with the given mode. | |
| write ($data) | |
| Write some data. | |
| read ($length, $offset=0) | |
| Read some data. | |
| grabFile () | |
| Gets the full contents of this file. | |
| close () | |
| Close the file and commit changes. | |
| delete () | |
| Delete this file. | |
| seek ($position) | |
| Seek a position in the file. | |
| tell () | |
| Return the current position of the file. | |
| size () | |
| Return the size of the file in bytes. | |
| eof () | |
| Return a boolean value whether the file handle is at the end of the file. | |
| exists () | |
| setFilestore (ElggFilestore $filestore) | |
| Set a filestore. | |
| save () | |
| Override the save function. | |
Protected Member Functions | |
| initialise_attributes () | |
| Initialise the attributes array. | |
| getFilestore () | |
| Return a filestore suitable for saving this file. | |
This class represents a physical file.
Usage: Create a new ElggFile object and specify a filename, and optionally a FileStore (if one isn't specified then the default is assumed.
Open the file using the appropriate mode, and you will be able to read and write to the file.
Optionally, you can also call the file's save() method, this will turn the file into an entity in the system and permit you to do things like attach tags to the file etc. This is not done automatically since there are many occasions where you may want access to file data on datastores using the ElggFile interface but do not want to create an Entity reference to it in the system (temporary files for example).
Definition at line 384 of file filestore.php.
| ElggFile::__construct | ( | $ | guid = null |
) |
Construct a new object entity, optionally from a given id value.
| mixed | $guid If an int, load that GUID. If a db row then will attempt to load the rest of the data. |
| Exception | if there was a problem creating the object. |
Reimplemented from ElggObject.
Definition at line 399 of file filestore.php.
| ElggFile::close | ( | ) |
Close the file and commit changes.
Definition at line 535 of file filestore.php.
| ElggFile::delete | ( | ) |
| ElggFile::eof | ( | ) |
Return a boolean value whether the file handle is at the end of the file.
Definition at line 595 of file filestore.php.
| ElggFile::exists | ( | ) |
Definition at line 602 of file filestore.php.
| ElggFile::getFilename | ( | ) |
Return the filename.
Definition at line 417 of file filestore.php.
| ElggFile::getFilenameOnFilestore | ( | ) |
Return the filename of this file as it is/will be stored on the filestore, which may be different to the filename.
Definition at line 423 of file filestore.php.
| ElggFile::getFilestore | ( | ) | [protected] |
Return a filestore suitable for saving this file.
This filestore is either a pre-registered filestore, a filestore loaded from metatags saved along side this file, or the system default.
Definition at line 624 of file filestore.php.
| ElggFile::getFilestoreSize | ( | $ | prefix = '', |
|
| $ | container_guid = 0 | |||
| ) |
Definition at line 429 of file filestore.php.
| ElggFile::getMimeType | ( | ) |
Get the mime type of the file.
Definition at line 440 of file filestore.php.
| ElggFile::grabFile | ( | ) |
Gets the full contents of this file.
Definition at line 525 of file filestore.php.
| ElggFile::initialise_attributes | ( | ) | [protected] |
Initialise the attributes array.
This is vital to distinguish between metadata and base parameters.
Place your base parameters here.
Reimplemented from ElggObject.
Definition at line 392 of file filestore.php.
| ElggFile::open | ( | $ | mode | ) |
Open the file with the given mode.
| string | $mode Either read/write/append |
Definition at line 467 of file filestore.php.
| ElggFile::read | ( | $ | length, | |
| $ | offset = 0 | |||
| ) |
Read some data.
| int | $length Amount to read. | |
| int | $offset The offset to start from. |
Definition at line 513 of file filestore.php.
| ElggFile::save | ( | ) |
Override the save function.
Reimplemented from ElggObject.
Definition at line 668 of file filestore.php.
| ElggFile::seek | ( | $ | position | ) |
Seek a position in the file.
| int | $position |
Definition at line 565 of file filestore.php.
| ElggFile::setDescription | ( | $ | description | ) |
Set the optional file description.
| string | $description The description. |
Definition at line 460 of file filestore.php.
| ElggFile::setFilename | ( | $ | name | ) |
Set the filename of this file.
| string | $name The filename. |
Definition at line 412 of file filestore.php.
| ElggFile::setFilestore | ( | ElggFilestore $ | filestore | ) |
Set a filestore.
| ElggFilestore | $filestore The file store. |
Definition at line 614 of file filestore.php.
| ElggFile::setMimeType | ( | $ | mimetype | ) |
Set the mime type of the file.
| $mimetype | The mimetype |
Definition at line 453 of file filestore.php.
| ElggFile::size | ( | ) |
Return the size of the file in bytes.
Definition at line 587 of file filestore.php.
| ElggFile::tell | ( | ) |
Return the current position of the file.
Definition at line 577 of file filestore.php.
| ElggFile::write | ( | $ | data | ) |
1.6.3