Public Member Functions | |
| startup (&$controller) | |
| save (&$data, $clone=false, $getInfoUrl=true) | |
| Save object $data If $data['id'] modify otherwise create If file is already present, throw an exception. | |
| del ($id) | |
| Delete object. | |
| url ($id) | |
| Return URL of file object. | |
| path ($id) | |
| Return object path, URL if remote file. | |
| isPresent ($path, $id=null) | |
| Return object id (object that contains file $path). | |
| getInfoURL (&$data) | |
| get mime type | |
| getMimeType ($data) | |
| getMimeTypeByExtension ($filename) | |
| getPathTargetFile (&$name) | |
| Get path where to save uploaded file. | |
Public Attributes | |
| $components = array('Transaction') | |
| $paranoid = true | |
| $validateErrors = false | |
Uses Transaction component.
Data to be passed to save an object with a file:
path temporary file path or URL name Name of original file type MIME type, if not set, try to get from file name ( Exceptions: BEditaFileExistException // File already exists (thrown in creation) BEditaInfoException // File info not readable (access denied or no data) BEditaMIMEException // MIME type not found or not corresponding to object type BEditaURLRxception // URL rules violated BEditaSaveStreamObjException // Error creating/modifying object BEditaDeleteStreamObjException // Error deleting object
If paranoid == false: remote info not loaded ['allow_php_fopen' not necessary]. Mime info should be passed with data for URLs.
File paths saved on DB are relative to $config['mediaRoot']
Definition at line 52 of file be_file_handler.php.
| BeFileHandlerComponent.save | ( | &$ | data, | |
| $ | clone = false, |
|||
| $ | getInfoUrl = true | |||
| ) |
Save object $data If $data['id'] modify otherwise create If file is already present, throw an exception.
File data: path: local path or URL (\.+//:\.+) [remote file] if "allow_url_fopen" is not activated, remote file is not accepted name Name of file. Empty if path == URL type MIME type. Empty if path == URL size File size. Empty if path == URL
| array | $dati object data |
Definition at line 92 of file be_file_handler.php.
| BeFileHandlerComponent.del | ( | $ | id | ) |
Delete object.
| integer | $id object id |
Definition at line 106 of file be_file_handler.php.
| BeFileHandlerComponent.url | ( | $ | id | ) |
Return URL of file object.
| integer | $id object id |
Definition at line 127 of file be_file_handler.php.
| BeFileHandlerComponent.path | ( | $ | id | ) |
Return object path, URL if remote file.
| integer | $id object id |
Definition at line 137 of file be_file_handler.php.
| BeFileHandlerComponent.isPresent | ( | $ | path, | |
| $ | id = null | |||
| ) |
Return object id (object that contains file $path).
| string | $path File name or URL |
Definition at line 148 of file be_file_handler.php.
References getPathTargetFile().
| BeFileHandlerComponent.getPathTargetFile | ( | &$ | name | ) |
Get path where to save uploaded file.
| string | $name Nome del file |
Definition at line 532 of file be_file_handler.php.
Referenced by isPresent().
BEdita 3.0.1 betula