Overview

Packages

  • Auth
    • Ads
    • Ldap
    • Xoops
  • Autotasks
  • Config
    • Category
    • Item
    • Option
  • Core
    • Filesystem
    • Filters
    • Logger
    • Mail
    • Message
    • Password
    • Security
    • StopSpammer
    • Template
    • Textsanitizer
    • VersionChecker
  • Data
    • Avatar
    • Comment
  • Database
    • Connection
    • Criteria
    • Legacy
    • MySQL
    • PDO
    • Updater
  • Feeds
    • RSS
  • File
  • Form
    • Base
    • Elements
  • ICMS
    • IPF
      • View
  • Image
    • Category
  • Ipf
    • Category
    • Controller
    • Export
    • form
    • Keyhighlighter
    • Member
    • Object
    • Permission
    • richfile
    • Tree
    • urllink
    • View
  • kernel
    • Set
  • Member
    • Group
    • GroupMembership
    • GroupPermission
    • User
  • Messaging
  • Module
  • None
  • Notification
  • Page
  • Plugins
    • Editor
  • Preload
    • Libraries
  • Privmessage
  • Session
  • SmartObject
  • View
    • Block
    • Breadcrumb
    • PageNav
    • PrinterFriendly
    • Template
    • Templates
    • Theme
    • Tree

Classes

  • icms_file_DownloadHandler
  • icms_file_MediaUploadHandler
  • icms_file_TarDownloader
  • icms_file_TarFileHandler
  • icms_file_ZipDownloader
  • Overview
  • Package
  • Class

Class icms_file_MediaUploadHandler

Upload Media files Example of usage:

$allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png');
$maxfilesize = 50000;
$maxfilewidth = 120;
$maxfileheight = 120;
$uploader = new icms_file_MediaUploadHandler('/home/httpdocs/uploads', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
if($uploader->fetchMedia($_POST['uploade_file_name'])) {
    if(!$uploader->upload()) {
        echo $uploader->getErrors();
    } else {
        echo '<h4>File uploaded successfully!</h4>'
        echo 'Saved as: ' . $uploader->getSavedFileName() . '<br />';
        echo 'Full path: ' . $uploader->getSavedDestination();
    }
} else {
  echo $uploader->getErrors();
}
Package: File
Category: ICMS
Copyright: copyright (c) 2000-2007 XOOPS.org
License: GNU General Public License (GPL)
Author: Kazumi Ono onokazu@xoops.org
Author: phppp
Located at file/MediaUploadHandler.php
Methods summary
public
# __construct( string $uploadDir, array $allowedMimeTypes, integer $maxFileSize = 0, integer $maxWidth = null, integer $maxHeight = null )

Constructor

Constructor

Parameters

$uploadDir
$allowedMimeTypes
$maxFileSize
$maxWidth
$maxHeight
public boolean
# fetchMedia( string $media_name, integer $index = null )

Fetch the uploaded file

Fetch the uploaded file

Parameters

$media_name
Name of the file field
$index
Index of the file (if more than one uploaded under that name)

Returns

boolean
public
# setTargetFileName( string $value )

Set the target filename

Set the target filename

Parameters

$value
public
# setPrefix( string $value, boolean $unique = true )

Set the prefix

Set the prefix

Parameters

$value
$unique
public string
# getMediaName( )

Get the uploaded filename

Get the uploaded filename

Returns

string
public string
# getMediaType( )

Get the type of the uploaded file

Get the type of the uploaded file

Returns

string
public integer
# getMediaSize( )

Get the size of the uploaded file

Get the size of the uploaded file

Returns

integer
public string
# getMediaTmpName( )

Get the temporary name that the uploaded file was stored under

Get the temporary name that the uploaded file was stored under

Returns

string
public string
# getSavedFileName( )

Get the saved filename

Get the saved filename

Returns

string
public string
# getSavedDestination( )

Get the destination the file is saved to

Get the destination the file is saved to

Returns

string
public boolean
# upload( $chmod = 0644 )

Check the file and copy it to the destination

Check the file and copy it to the destination

Returns

boolean
public boolean
# checkMaxFileSize( )

Is the file the right size?

Is the file the right size?

Returns

boolean
public boolean
# checkMaxWidth( )

Is the picture the right width?

Is the picture the right width?

Returns

boolean
public boolean
# checkMaxHeight( )

Is the picture the right height?

Is the picture the right height?

Returns

boolean
public boolean
# checkMimeType( )

Check whether or not the uploaded file type is allowed

Check whether or not the uploaded file type is allowed

Returns

boolean
public boolean
# checkImageType( )

Check whether or not the uploaded image type is valid

Check whether or not the uploaded image type is valid

Returns

boolean
public
# sanitizeMultipleExtensions( )

Sanitize executable filename with multiple extensions

Sanitize executable filename with multiple extensions

public
# setErrors( string $error )

Add an error

Add an error

Parameters

$error
public array|string
# getErrors( boolean $ashtml = true )

Get generated errors

Get generated errors

Parameters

$ashtml
Format using HTML?

Returns

array|string
Array of array messages OR HTML string
API documentation generated by ApiGen