Class Gadget_Upload

Description

Gadget_Upload

  • since: 1.0

Located in /Gadget/Upload.php (line 38)

Gadget_Object
   |
   --Gadget_Upload
Variable Summary
int $error
string $ext
string $name
int $size
string $tmp_name
string $type
Method Summary
bool checkExt (array $exts, [bool $deny = false])
bool checkSize (mixed $size)
bool checkType (string $type)
mixed &getFile (string $name)
mixed moveTo (string $destination, [bool $overwrite = true])
string nameToSafe ()
string nameToUniq ([mixed $prefix = 'upload'])
Variables
int $error (line 80)

Error Code

string $ext (line 45)

File Extension

string $name (line 52)

File Name

int $size (line 73)

File Size in Bytes

string $tmp_name (line 66)

Temporary Name

string $type (line 59)

File Type

Methods
checkExt (line 184)

Check File Extension

  • access: public
bool checkExt (array $exts, [bool $deny = false])
  • array $exts
  • bool $deny
checkSize (line 170)

Check File Size

  • access: public
bool checkSize (mixed $size)
  • mixed $size
checkType (line 196)

Check File Type

  • access: public
bool checkType (string $type)
  • string $type
getFile (line 111)

Get Uploaded File

Usage:

 while ($file = &Gadget_Upload::getFile('images')) {
     if ($file->checkSize(50000)) {
         $file->nameToSafe();
         $file->moveTo('./uploads');
     }
 }

  • access: public
  • static:
mixed &getFile (string $name)
  • string $name
moveTo (line 146)

Move uploaded File

  • return: Returns true on success or PEAR_Error on failure.
mixed moveTo (string $destination, [bool $overwrite = true])
  • string $destination: just the directory!
  • bool $overwrite
nameToSafe (line 222)

Name to Safe

  • return: new name
  • access: public
string nameToSafe ()
nameToUniq (line 211)

Name to Uniq

  • return: new name
  • access: public
string nameToUniq ([mixed $prefix = 'upload'])
onAfterConstruct (line 88)

On After Construct

  • access: protected
void onAfterConstruct ()

Redefinition of:
Gadget_Object::onAfterConstruct()
On After Construct

Inherited Methods

Inherited From Gadget_Object

Gadget_Object::Gadget_Object()
Gadget_Object::onAfterConstruct()
Gadget_Object::onBeforeConstruct()
Gadget_Object::setOptions()

Documentation generated on Sun, 03 Jul 2005 12:46:11 +0200 by phpDocumentor 1.3.0RC3