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

Class: HTTP_Upload_File

Source Location: /HTTP_Upload-1.0.0b2/HTTP/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 447]
This class provides functions to work with the uploaded file


[ Top ]


Class Variables

$mode_name_selected =  false

[line 459]

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

Type:   boolean


[ Top ]

$upload = array()

[line 453]

Assoc array with file properties

Type:   array


[ Top ]



Method Detail

HTTP_Upload_File (Constructor)   [line 505]

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], [ $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
   $chmod     

[ Top ]

errorMsg   [line 806]

string errorMsg( )

Returns a error message, if a error occured

(deprecated) Use getMessage() instead

  • Return: a Error message
  • Access: public

[ Top ]

getMessage   [line 816]

string getMessage( )

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

[ Top ]

getProp   [line 792]

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 ]

getValidExtensions   [line 828]

array getValidExtensions( )

Returns an array with all valid file extensions.
  • Return: Array of extensions without dot.
  • Access: public

[ Top ]

isError   [line 699]

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

bool isMissing( )

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

[ Top ]

isValid   [line 670]

bool isValid( )

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

[ Top ]

moveTo   [line 715]

mixed moveTo( string $dir, [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     Destination directory
bool   $overwrite     Overwrite if destination file exists?

[ Top ]

nameToSafe   [line 653]

string nameToSafe( $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
   $name     

[ Top ]

nameToSeq   [line 600]

void nameToSeq( string $dir)

Sequence file names in the form: userGuide[1].pdf, userGuide[2].pdf ...

Parameters:

string   $dir     Destination directory

[ Top ]

nameToUniq   [line 639]

void nameToUniq( )

Unique file names in the form: 9022210413b75410c28bef.html

[ Top ]

setName   [line 563]

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', 'seq', '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 849]

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

Function to restrict the valid extensions on file uploads.

Restrictions are applied to the name of the file on the user's disk, not the destination file name used at moveTo().

  • 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
bool   $case_sensitive     whether extension check is case sensitive. When it is case insensitive, the extension is lowercased before compared to the array of valid extensions.

[ Top ]


Documentation generated on Tue, 05 Oct 2010 16:30:02 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.