BeFileHandlerComponent Class Reference

File upload, save, modify, delete, manage (remote as well). More...

List of all members.

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


Detailed Description

File upload, save, modify, delete, manage (remote as well).

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']

Version:
Revision
2448
Modified By:
LastChangedBy
bato
Last Modified: $LastChangedDate
LastChangedDate
2009-11-11 16:16:05 +0100 (mer, 11 nov 2009)

Id
be_file_handler.php 2448 2009-11-11 15:16:05Z bato

Definition at line 52 of file be_file_handler.php.


Member Function Documentation

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

Parameters:
array $dati object data
Returns:
integer or false (id of the object created or modified)

Definition at line 92 of file be_file_handler.php.

BeFileHandlerComponent.del ( id  ) 

Delete object.

Parameters:
integer $id object id

Definition at line 106 of file be_file_handler.php.

BeFileHandlerComponent.url ( id  ) 

Return URL of file object.

Parameters:
integer $id object id

Definition at line 127 of file be_file_handler.php.

BeFileHandlerComponent.path ( id  ) 

Return object path, URL if remote file.

Parameters:
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).

Parameters:
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.

Parameters:
string $name Nome del file

Definition at line 532 of file be_file_handler.php.

Referenced by isPresent().


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

Generated on Tue Jan 12 15:45:35 2010  BEditaBEdita 3.0.1 betula