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

Class: HTTP_Upload_File

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


[ Top ]


Class Variables

$mode_name_selected =  false

[line 602]

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

Type:   boolean


[ Top ]

$upload = array()

[line 596]

Assoc array with file properties

Type:   array


[ Top ]



Method Detail

HTTP_Upload_File (Constructor)   [line 648]

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

string errorMsg( )

Returns a error message, if a error occured

(deprecated) Use getMessage() instead

  • Return: a Error message
  • Access: public

[ Top ]

getMessage   [line 957]

string getMessage( )

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

[ Top ]

getProp   [line 933]

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

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

bool isMissing( )

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

[ Top ]

isValid   [line 811]

bool isValid( )

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

[ Top ]

moveTo   [line 856]

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

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

void nameToSeq( string $dir)

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

Parameters:

string   $dir   —  Destination directory

[ Top ]

nameToUniq   [line 780]

void nameToUniq( )

Unique file names in the form: 9022210413b75410c28bef.html

[ Top ]

setName   [line 704]

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

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

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
bool   $case_sensitive   —  whether extension check is case sensitive.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:32:50 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.