Transaction Engine 3 Application Programming Interface
[ class tree: Transaction Engine 3 Application Programming Interface ] [ index: Transaction Engine 3 Application Programming Interface ] [ all elements ]

Class: KT_fileUpload

Source Location: /common/lib/file_upload/KT_FileUpload.class.php

Class Overview


Provides functionalities for handling file uploads


Author(s):

Variables

Methods



Class Details

[line 10]
Provides functionalities for handling file uploads



Tags:

access:  public


[ Top ]


Class Variables

$allowedExtensions =

[line 40]

the allowed types for upload



Tags:

var:  tNG_dispatcher
access:  public

Type:   array


[ Top ]

$autoRename =

[line 45]



Tags:

access:  public

Type:   boolean


[ Top ]

$destinationName =

[line 69]

the name under which the file was saved after upload



Tags:

var:  tNG_dispatcher
access:  public

Type:   string


[ Top ]

$develErrorMessage = array()

[line 81]

error message to be displayed as Developer Error



Tags:

access:  public

Type:   array


[ Top ]

$errorType = array()

[line 75]

error message to be displayed as User Error



Tags:

access:  public

Type:   array


[ Top ]

$fileExists =

[line 22]



Tags:

access:  public

Type:   boolean


[ Top ]

$fileInfo =

[line 17]

the file upload information



Tags:

var:  tNG_dispatcher
access:  public

Type:   string


[ Top ]

$folder =

[line 28]

destination folder for upload



Tags:

access:  public

Type:   string


[ Top ]

$isRequired =

[line 34]

specifies if the file is required for upload or not



Tags:

access:  public

Type:   bollean


[ Top ]

$maxSize =

[line 57]

maximum allowed size of the uploaded file in KB;



Tags:

access:  public

Type:   integer


[ Top ]

$minSize =

[line 51]

minimum allowed size of the uploaded file in KB;



Tags:

access:  public

Type:   integer


[ Top ]

$oldFileName =

[line 63]

Specifies the old file name that is allowed to be overwritten in case that its name is the same as the file to be uploaded (fileName)



Tags:

access:  public

Type:   string


[ Top ]



Class Methods


constructor KT_fileUpload [line 87]

KT_fileUpload KT_fileUpload( )

Constructor.

sets initialise some class members;




Tags:

access:  public


[ Top ]

method checkExtensions [line 313]

nothing; checkExtensions( )

Checks the type of the uploaded folder.

The name is checked against the this.allowedTypes array.




Tags:

access:  public


[ Top ]

method checkFileName [line 331]

nothing; checkFileName( mixed $fileName, string $filename)

check if a filename is valid. invalid chars: .., \, /, :, *, ?, ", <, >, |



Tags:

access:  public


Parameters:

string   $filename   the name of the form field;

[ Top ]

method checkFolder [line 272]

nothing; checkFolder( )

Check if the uploaded folder exists and has write permissions.

If the folder does not exists, try to create it. If the folder does not have write permissions or if could not create it, set error.




Tags:

access:  public


[ Top ]

method checkSize [line 294]

nothing; checkSize( )

Checks the size of the uploaded folder.

The size is checked against the this.minSize and this.maxSize




Tags:

access:  public


[ Top ]

method checkUpload [line 352]

nothing; checkUpload( )

Checks if the upload has performed OK and if the file is required.



Tags:

access:  public


[ Top ]

method getError [line 454]

array getError( )

Getter. return the errors setted.



Tags:

return:  array - 0=>error for user, 1=>error for developer;
access:  public


[ Top ]

method getTempName [line 248]

string getTempName( string $filename)

Gets a temporary file name starting from the given file name.

Ex: filename = 'zone.jpg', and zone_1.jpg alreagy exists, the new file name is zone_2.jpg.




Tags:

return:  the temporary file name;
access:  public


Parameters:

string   $filename   the filename on which to create the new temporary file name.

[ Top ]

method hasError [line 441]

boolean hasError( )

check if an error was setted.



Tags:

return:  true if error is set or false if not;
access:  public


[ Top ]

method RollBack [line 406]

nothing; RollBack( )

Makes RollBack if transaction failed.



Tags:

access:  public


[ Top ]

method setAllowedExtensions [line 151]

nothing; setAllowedExtensions( array $allowedExtensions)

setter. set the allowed extendions



Tags:

access:  public


Parameters:

array   $allowedExtensions   ;

[ Top ]

method setAutoRename [line 161]

nothing; setAutoRename( boolean $autoRename)

setter.



Tags:

access:  public


Parameters:

boolean   $autoRename   ;

[ Top ]

method setFileInfo [line 105]

nothing; setFileInfo( string $fileInfo)

setter. set the fileinfo array



Tags:

access:  public


Parameters:

string   $fileInfo   the name of the form field;

[ Top ]

method setFolder [line 126]

nothing; setFolder( string $folder)

setter. set the destination folder



Tags:

access:  public


Parameters:

string   $folder   the name of the folder;

[ Top ]

method setMaxSize [line 181]

nothing; setMaxSize( integer $maxSize)

setter.



Tags:

access:  public


Parameters:

integer   $maxSize   the maximum size of the file in KB;

[ Top ]

method setMinSize [line 171]

nothing; setMinSize( integer $minSize)

setter.



Tags:

access:  public


Parameters:

integer   $minSize   the minimum size of the files in KB;

[ Top ]

method setRequired [line 141]

nothing; setRequired( boolean $isRequired)

setter.



Tags:

access:  public


Parameters:

boolean   $isRequired   the name of the form field;

[ Top ]

method uploadFile [line 194]

string uploadFile( string $fileName, [string $oldFileName = ""])

Handle the uploaded file by moving it to a destination file.

The destination file = folder + fileName




Tags:

return:  file name if succeded or null if not;
access:  public


Parameters:

string   $oldFileName   the previous file name, or null on insert
string   $fileName   fileName the name for saving the uploaded file;

[ Top ]



Documentation generated on Tue, 6 Dec 2005 15:11:29 +0200 by phpDocumentor 1.3.0RC3