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

Class: HTTP_Upload_File

Source Location: /HTTP_Upload-1.0.0b3/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::__construct()
PHP5 Constructor
HTTP_Upload_Error::HTTP_Upload_Error()
PHP4 Constructor
HTTP_Upload_Error::errorCode()
returns the error code
HTTP_Upload_Error::raiseError()
Overwrites the PEAR::raiseError method

Class Details

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


[ Top ]


Class Variables

$mode_name_selected =  false

[line 478]

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

Type:   boolean


[ Top ]

$upload = array()

[line 472]

Assoc array with file properties

Type:   array


[ Top ]



Method Detail

HTTP_Upload_File (Constructor)   [line 577]

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

PHP4 Constructor

Parameters:

   $name   — 
   $tmp   — 
   $formname   — 
   $type   — 
   $size   — 
   $error   — 
   $lang   — 
   $chmod   — 

[ Top ]

__construct (Constructor)   [line 524]

HTTP_Upload_File __construct( [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])

PHP5 Constructor
  • Access: public

Overrides HTTP_Upload_Error::__construct() (PHP5 Constructor)

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

string errorMsg( )

Returns a error message, if a error occured

(deprecated) Use getMessage() instead

  • Return: a Error message
  • Access: public

[ Top ]

getMessage   [line 847]

string getMessage( )

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

[ Top ]

getProp   [line 823]

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

array getValidExtensions( )

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

[ Top ]

hasError   [line 730]

bool hasError( )

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

bool isMissing( )

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

[ Top ]

isValid   [line 701]

bool isValid( )

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

[ Top ]

moveTo   [line 746]

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

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

void nameToSeq( string $dir)

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

Parameters:

string   $dir   —  Destination directory

[ Top ]

nameToUniq   [line 670]

void nameToUniq( )

Unique file names in the form: 9022210413b75410c28bef.html

[ Top ]

setName   [line 594]

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

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 Wed, 09 Dec 2015 23:16:36 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.