OssnFile Class Reference
Inheritance diagram for OssnFile:
OssnEntities OssnDatabase OssnBase

Public Member Functions

 MaxSize ()
 
 setFile ($name)
 
 setPath ($path)
 
 getFileExtension ($file)
 
 allowedFileExtensions ()
 
 getFileUploadError ($code)
 
 showFileUploadError ()
 
 addFile ()
 
 getFiles ()
 
 fetchFile ()
 
 setExtension (array $extension=array())
 
 setMimeTypes (array $mimtypes=array())
 
 typeAllowed ()
 
- Public Member Functions inherited from OssnEntities
 add ()
 
 get_entity ()
 
 save ()
 
 get_entities ()
 
 AddedEntityGuid ()
 
 updateEntity ()
 
 deleteByOwnerGuid ($guid, $type)
 
 deleteEntity ($guid)
 
 searchEntities (array $params=array())
 
 canChange ($user= '')
 
- Public Member Functions inherited from OssnDatabase
 Connect ()
 
 insert ($params)
 
 statement ($query)
 
 execute ()
 
 update ($params=array())
 
 select ($params, $multi= '')
 
 fetch ($data=false)
 
 delete ($params)
 
 getLastEntry ()
 
 constructWheres (array $array, $operator="AND")
 
 generateLimit ($data_limit=false, $page_limit=false, $offset=false)
 
- Public Member Functions inherited from OssnBase
 getGUID ()
 
 getID ()
 
 getParam ($param)
 
 isParam ($param)
 

Static Public Member Functions

static DeleteDir ($path)
 
static moveFiles ($from, $to)
 
static mimeTypes ()
 

Detailed Description

Definition at line 11 of file OssnFile.php.

Member Function Documentation

addFile ( )

addFile Add file to database

Parameters
integer$object-,>owner_guidGuid of owner , the file belongs to
string$object-,>typeOwner type,
string$object-,>subtypefile type
Returns
boolean

Definition at line 192 of file OssnFile.php.

allowedFileExtensions ( )

Allowed file extensions Validate file extension before save

Returns
boolean

Definition at line 103 of file OssnFile.php.

static DeleteDir (   $path)
static

DeleteDir Delete the directories including files

Parameters
string$pathpath of directory
Returns
boolean

Definition at line 20 of file OssnFile.php.

fetchFile ( )

Get file by id

Parameters
integer$object-,>file_idguid of file in database
string$object-,>typeOwner type
string$object-,>subtypefile type
Returns
object

Definition at line 261 of file OssnFile.php.

getFileExtension (   $file)

Get file extension from its name

Parameters
string$fileFull file name
Returns
string|false

Definition at line 88 of file OssnFile.php.

getFiles ( )

getFiles Get owner files

Parameters
integer$object-,>owner_guidGuid of owner , the file belongs to
string$object-,>typeOwner type
string$object-,>subtypeFile type
Returns
object

Definition at line 243 of file OssnFile.php.

getFileUploadError (   $code)

getFileUploadError Print user friendly file upload error

Parameters
integer$codeError code
Returns
string

Definition at line 127 of file OssnFile.php.

MaxSize ( )

MaxSize Get server post max size

Returns
float;

Definition at line 43 of file OssnFile.php.

static mimeTypes ( )
static

MIME types.

This function contains most commonly used MIME types in Ossn

You can find mimtypes on the url below: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/mime.types?view=markup

Extra mimetypes has been removed in Ossn v3.1. You can add a hook to extends mimetypes

Returns
array

Definition at line 353 of file OssnFile.php.

static moveFiles (   $from,
  $to 
)
static

moveFiles Move files from one directory to another

Parameters
string$fromComplete directory path from where you want to move files.
string$toComplete directory path where you want to move files.
Returns
boolean

Definition at line 322 of file OssnFile.php.

setExtension ( array  $extension = array())

Set required file extension

Parameters
array$extensionUploaded file extension can be jpg, jpeg
Returns
void

Definition at line 273 of file OssnFile.php.

setFile (   $name)

setFile Set a required file in memory

Parameters
string$name
Returns
void

Definition at line 65 of file OssnFile.php.

setMimeTypes ( array  $mimtypes = array())

Set required file mimetype If not set, it will try to match mimetype with pre-defined mime type

Parameters
array$mimtypesMimetypes that are allowed
Returns
void

Definition at line 284 of file OssnFile.php.

setPath (   $path)

Set a path for file where it need to upload

Parameters
string$pathPath where file need to save
Returns
void

Definition at line 79 of file OssnFile.php.

showFileUploadError ( )

showFileUploadError Show file upload errors

Returns
void

Definition at line 172 of file OssnFile.php.

typeAllowed ( )

Validate a uploaded file

Make sure the file extension match also check mimetype

Returns
boolean

Definition at line 294 of file OssnFile.php.


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