HTTP_Upload
[ class tree: HTTP_Upload ] [ index: HTTP_Upload ] [ all elements ]

Class: HTTP_Upload_File

Source Location: /HTTP_Upload-0.9.1/Upload.php

Class Overview

PEAR
   |
   --HTTP_Upload_Error
      |
      --HTTP_Upload_File

This class provides functions to work with the uploaded file


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods

Class: HTTP_Upload_Error

HTTP_Upload_Error::HTTP_Upload_Error()
Constructor
HTTP_Upload_Error::errorCode()
returns the error code
HTTP_Upload_Error::raiseError()
Overwrites the PEAR::raiseError method

Class Details

[line 500]
This class provides functions to work with the uploaded file


[ Top ]


Class Variables

$mode_name_selected =  false

[line 518]

If user haven't selected a mode, by default 'safe' will be used

Type:   boolean


[ Top ]

$upload = array()

[line 512]

Assoc array with file properties

Type:   array


[ Top ]



Method Detail

HTTP_Upload_File (Constructor)   [line 556]

HTTP_Upload_File HTTP_Upload_File( [string $name = null], [string $tmp = null], [string $formname = null], [string $type = null], [string $size = null], [string $error = null], [string $lang = null], [mixed $chmod = HTTP_UPLOAD_DEFAULT_CHMOD])

Constructor
  • Access: public

Parameters:

string   $name     destination file name
string   $tmp     temp file name
string   $formname     name of the form
string   $type     Mime type of the file
string   $size     size of the file
string   $error     error on upload
string   $lang     used language for errormessages

[ Top ]

errorMsg   [line 802]

string errorMsg( )

Returns a error message, if a error occured

(deprecated) Use getMessage() instead

  • Return: a Error message
  • Access: public

[ Top ]

getMessage   [line 812]

string getMessage( )

Returns a error message, if a error occured
  • Return: a Error message
  • Access: public

[ Top ]

getProp   [line 788]

mixed getProp( [string $name = null])

Retrive properties of the uploaded file

Parameters:

string   $name     The property name. When null an assoc array with all the properties will be returned

[ Top ]

isError   [line 707]

bool isError( )

Some error occured during upload (most common due a file size problem, like max size exceeded or 0 bytes long).
  • Return: If there were errors submitting the file (probably because the file excess the max permitted file size)
  • Access: public

[ Top ]

isMissing   [line 692]

bool isMissing( )

User haven't submit a file
  • Return: If the user submitted a file or not
  • Access: public

[ Top ]

isValid   [line 678]

bool isValid( )

The upload was valid
  • Return: If the file was submitted correctly
  • Access: public

[ Top ]

moveTo   [line 723]

mixed moveTo( string $dir_dest, [bool $overwrite = true])

Moves the uploaded file to its destination directory.
  • Return: True on success or Pear_Error object on error
  • Access: public

Parameters:

string   $dir_dest     Destination directory
bool   $overwrite     Overwrite if destination file exists?

[ Top ]

nameToSafe   [line 661]

string nameToSafe( mixed $name, [int $maxlen = 250], string $file)

Format a file name to be safe

Parameters:

string   $file     The string file name
int   $maxlen     Maximun permited string lenght

[ Top ]

nameToUniq   [line 643]

void nameToUniq( )

Unique file names in the form: 9022210413b75410c28bef.html

[ Top ]

setName   [line 612]

string setName( string $mode, [string $prepend = null], [string $append = null])

Sets the name of the destination file
  • Return: The modified name of the destination file
  • Access: public

Parameters:

string   $mode     A valid mode: 'uniq', 'safe' or 'real' or a file name
string   $prepend     A string to prepend to the name
string   $append     A string to append to the name

[ Top ]

setValidExtensions   [line 827]

void setValidExtensions( array $exts, [string $mode = 'deny'])

Function to restrict the valid extensions on file uploads
  • Access: public

Parameters:

array   $exts     File extensions to validate
string   $mode     The type of validation: 1) 'deny' Will deny only the supplied extensions 2) 'accept' Will accept only the supplied extensions as valid

[ Top ]


Documentation generated on Wed, 11 Aug 2004 02:30:03 -0400 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.