[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/includes/ -> functions_upload.php (summary)

(no description)

Copyright: (c) 2005 phpBB Group
License: http://opensource.org/licenses/gpl-license.php GNU Public License
Version: $Id$
File Size: 1037 lines (26 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes

filespec:: (12 methods):
  filespec()
  clean_filename()
  get()
  is_image()
  is_uploaded()
  remove()
  get_extension()
  get_mimetype()
  get_filesize()
  check_content()
  move_file()
  additional_checks()

fileerror:: (1 method):
  fileerror()

fileupload:: (17 methods):
  fileupload()
  reset_vars()
  set_allowed_extensions()
  set_allowed_dimensions()
  set_max_filesize()
  set_disallowed_content()
  set_error_prefix()
  form_upload()
  local_upload()
  remote_upload()
  assign_internal_error()
  common_checks()
  valid_extension()
  valid_dimensions()
  is_valid()
  valid_content()
  image_types()


Class: filespec  - X-Ref

Responsible for holding all file relevant information, as well as doing file-specific operations.
The {@link fileupload fileupload class} can be used to upload several files, each of them being this object to operate further on.

filespec($upload_ary, $upload_namespace)   X-Ref
File Class


clean_filename($mode = 'unique', $prefix = '', $user_id = '')   X-Ref
Cleans destination filename

param: real|unique|unique_ext $mode real creates a realname, filtering some characters, lowering every character. Unique creates an unique filename
param: string $prefix Prefix applied to filename

get($property)   X-Ref
Get property from file object


is_image()   X-Ref
Check if file is an image (mimetype)

return: true if it is an image, false if not

is_uploaded()   X-Ref
Check if the file got correctly uploaded

return: true if it is a valid upload, false if not

remove()   X-Ref
Remove file


get_extension($filename)   X-Ref
Get file extension


get_mimetype($filename)   X-Ref
Get mimetype. Utilize mime_content_type if the function exist.
Not used at the moment...


get_filesize($filename)   X-Ref
Get filesize


check_content($disallowed_content)   X-Ref
Check the first 256 bytes for forbidden content


move_file($destination, $overwrite = false, $skip_image_check = false, $chmod = false)   X-Ref
Move file to destination folder
The phpbb_root_path variable will be applied to the destination path

param: string $destination_path Destination path, for example $config['avatar_path']
param: bool $overwrite If set to true, an already existing file will be overwritten
param: string $chmod Permission mask for chmodding the file after a successful move. The mode entered here reflects the mode defined by {@link phpbb_chmod()}

additional_checks()   X-Ref
Performing additional checks


Class: fileerror  - X-Ref

Class for assigning error messages before a real filespec class can be assigned

fileerror($error_msg)   X-Ref
No description

Class: fileupload  - X-Ref

File upload class
Init class (all parameters optional and able to be set/overwritten separately) - scope is global and valid for all uploads

fileupload($error_prefix = '', $allowed_extensions = false, $max_filesize = false, $min_width = false, $min_height = false, $max_width = false, $max_height = false, $disallowed_content = false)   X-Ref
Init file upload class.

param: string $error_prefix Used error messages will get prefixed by this string
param: array $allowed_extensions Array of allowed extensions, for example array('jpg', 'jpeg', 'gif', 'png')
param: int $max_filesize Maximum filesize
param: int $min_width Minimum image width (only checked for images)
param: int $min_height Minimum image height (only checked for images)
param: int $max_width Maximum image width (only checked for images)
param: int $max_height Maximum image height (only checked for images)

reset_vars()   X-Ref
Reset vars


set_allowed_extensions($allowed_extensions)   X-Ref
Set allowed extensions


set_allowed_dimensions($min_width, $min_height, $max_width, $max_height)   X-Ref
Set allowed dimensions


set_max_filesize($max_filesize)   X-Ref
Set maximum allowed filesize


set_disallowed_content($disallowed_content)   X-Ref
Set disallowed strings


set_error_prefix($error_prefix)   X-Ref
Set error prefix


form_upload($form_name)   X-Ref
Form upload method
Upload file from users harddisk

param: string $form_name Form name assigned to the file input field (if it is an array, the key has to be specified)
return: object $file Object "filespec" is returned, all further operations can be done with this object

local_upload($source_file, $filedata = false)   X-Ref
Move file from another location to phpBB


remote_upload($upload_url)   X-Ref
Remote upload method
Uploads file from given url

param: string $upload_url URL pointing to file to upload, for example http://www.foobar.com/example.gif
return: object $file Object "filespec" is returned, all further operations can be done with this object

assign_internal_error($errorcode)   X-Ref
Assign internal error


common_checks(&$file)   X-Ref
Perform common checks


valid_extension(&$file)   X-Ref
Check for allowed extension


valid_dimensions(&$file)   X-Ref
Check for allowed dimension


is_valid($form_name)   X-Ref
Check if form upload is valid


valid_content(&$file)   X-Ref
Check for allowed extension


image_types()   X-Ref
Return image type/extension mapping




Generated: Wed Oct 2 15:03:47 2013 Cross-referenced by PHPXref 0.7.1