![]() |
XOOPS API 2.5.11 Beta1
UI v0.5
Réalisé par monxoops.fr
|
Fonctions membres publiques | |
| __construct ($uploadDir, $allowedMimeTypes, $maxFileSize=0, $maxWidth=null, $maxHeight=null, $randomFilename=false) | |
| return_bytes ($size_str) | |
| countMedia ($media_name) | |
| fetchMedia ($media_name, $index=null) | |
| setTargetFileName ($value) | |
| setPrefix ($value) | |
| getMediaName () | |
| getMediaType () | |
| getMediaSize () | |
| getMediaTmpName () | |
| getSavedFileName () | |
| getSavedDestination () | |
| upload ($chmod=0644) | |
| _copyFile ($chmod) | |
| checkMaxFileSize () | |
| checkMaxWidth () | |
| checkMaxHeight () | |
| checkMimeType () | |
| checkImageType () | |
| sanitizeMultipleExtensions () | |
| setErrors ($error) | |
| & | getErrors ($ashtml=true) |
Champs de données | |
| $allowUnknownTypes = false | |
| $mediaName | |
| $mediaType | |
| $mediaSize | |
| $mediaTmpName | |
| $mediaError | |
| $mediaRealType = '' | |
| $uploadDir = '' | |
| $allowedMimeTypes = array() | |
| $deniedMimeTypes | |
| $maxFileSize = 0 | |
| $maxWidth | |
| $maxHeight | |
| $targetFileName | |
| $prefix | |
| $errors = array() | |
| $savedDestination | |
| $savedFileName | |
| $extensionToMime = array() | |
| $checkImageType = true | |
| $extensionsToBeSanitized | |
| $imageExtensions | |
| $randomFilename = false | |
Fonctions membres protégées | |
| arrayPushIfPositive ($set, $value) | |
Upload Media files
Example of usage (single file): include_once 'uploader.php'; $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png'); $maxfilesize = 50000; $maxfilewidth = 120; $maxfileheight = 120; $randomFilename = true; $uploader = new XoopsMediaUploader('/home/xoops/uploads', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight, $randomFilename); if ($uploader->fetchMedia('single_file_name')) { if (!$uploader->upload()) { echo $uploader->getErrors(); } else { echo '
' echo 'Saved as: ' . $uploader->getSavedFileName() . '
'; echo 'Full path: ' . $uploader->getSavedDestination(); } } else { echo $uploader->getErrors(); }
Example of usage (multiple file): include_once 'uploader.php'; $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png'); $maxfilesize = 50000; $maxfilewidth = 120; $maxfileheight = 120; $randomFilename = true; $uploader = new XoopsMediaUploader('/home/xoops/uploads', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight, $randomFilename); for ($i = 0; $i < $uploader->countMedia('multiple_file_name'); $i++) { if ($uploader->fetchMedia('multiple_file_name')) { if (!$uploader->upload()) { echo $uploader->getErrors(); } else { echo '
' echo 'Saved as: ' . $uploader->getSavedFileName() . '
'; echo 'Full path: ' . $uploader->getSavedDestination(); } } else { echo $uploader->getErrors(); } }
| __construct | ( | $uploadDir, | |
| $allowedMimeTypes, | |||
$maxFileSize = 0, |
|||
$maxWidth = null, |
|||
$maxHeight = null, |
|||
$randomFilename = false |
|||
| ) |
Constructor
| string | $uploadDir | |
| array | $allowedMimeTypes | |
| int | $maxFileSize | |
| int | $maxWidth | |
| int | $maxHeight | |
| bool | $randomFilename |
Voici le graphe d'appel pour cette fonction :| _copyFile | ( | $chmod | ) |
Copy the file to its destination
| $chmod |
Voici le graphe d'appel pour cette fonction :
Voici le graphe des appelants de cette fonction :
|
protected |
Push value onto set. Used in max file size calculation to eliminate -1 (unlimited) ini values
| array | $set | array of values |
| int | $value | value to push |
Voici le graphe des appelants de cette fonction :| checkImageType | ( | ) |
Check whether or not the uploaded image type is valid
Voici le graphe d'appel pour cette fonction :
Voici le graphe des appelants de cette fonction :| checkMaxFileSize | ( | ) |
Is the file the right size?
Voici le graphe d'appel pour cette fonction :
Voici le graphe des appelants de cette fonction :| checkMaxHeight | ( | ) |
Is the picture the right height?
Voici le graphe d'appel pour cette fonction :
Voici le graphe des appelants de cette fonction :| checkMaxWidth | ( | ) |
Is the picture the right width?
Voici le graphe d'appel pour cette fonction :
Voici le graphe des appelants de cette fonction :| checkMimeType | ( | ) |
Check whether or not the uploaded file type is allowed
Voici le graphe d'appel pour cette fonction :
Voici le graphe des appelants de cette fonction :| countMedia | ( | $media_name | ) |
Count the uploaded files (in case of miltiple upload)
| string | $media_name | Name of the file field |
Voici le graphe d'appel pour cette fonction :| fetchMedia | ( | $media_name, | |
$index = null |
|||
| ) |
Fetch the uploaded file
| string | $media_name | Name of the file field |
| int | $index | Index of the file (if more than one uploaded under that name) |
Voici le graphe d'appel pour cette fonction :| & getErrors | ( | $ashtml = true | ) |
Get generated errors
| bool | $ashtml | Format using HTML? |
| getMediaName | ( | ) |
Get the uploaded filename
| getMediaSize | ( | ) |
Get the size of the uploaded file
| getMediaTmpName | ( | ) |
Get the temporary name that the uploaded file was stored under
| getMediaType | ( | ) |
Get the type of the uploaded file
| getSavedDestination | ( | ) |
Get the destination the file is saved to
| getSavedFileName | ( | ) |
Get the saved filename
| return_bytes | ( | $size_str | ) |
converts memory/file sizes as defined in php.ini to bytes
| $size_str |
Voici le graphe des appelants de cette fonction :| sanitizeMultipleExtensions | ( | ) |
Sanitize executable filename with multiple extensions
Voici le graphe des appelants de cette fonction :| setErrors | ( | $error | ) |
Add an error
| string | $error |
Voici le graphe des appelants de cette fonction :| setPrefix | ( | $value | ) |
Set the prefix
| string | $value |
| setTargetFileName | ( | $value | ) |
Set the target filename
| string | $value |
| upload | ( | $chmod = 0644 | ) |
Check the file and copy it to the destination
| int | $chmod |
Voici le graphe d'appel pour cette fonction :| $allowedMimeTypes = array() |
| $allowUnknownTypes = false |
Flag indicating if unrecognized mimetypes should be allowed (use with precaution ! may lead to security issues )
| $deniedMimeTypes |
| $errors = array() |
| $extensionsToBeSanitized |
| $extensionToMime = array() |
| $imageExtensions |
| $maxFileSize = 0 |
| $maxHeight |
| $maxWidth |
| $mediaError |
| $mediaName |
| $mediaRealType = '' |
| $mediaSize |
| $mediaTmpName |
| $mediaType |
| $prefix |
| $randomFilename = false |
| $savedDestination |
| $savedFileName |
| $targetFileName |
| $uploadDir = '' |