XOOPS
2.6.0
|
Public Member Functions | |
defaultAfterUploadManagement () | |
interceptAfterUpload ($str) | |
interceptBeforeUpload ($str) | |
JUpload ($appletparams=array(), $classparams=array()) | |
uploadedfiles () | |
Public Attributes | |
$appletparams | |
$classparams | |
$files | |
Protected Member Functions | |
logDebug ($function, $msg, $htmlComment=true) | |
logPHPDebug ($function, $msg) | |
Private Member Functions | |
abort ($msg= '') | |
arrayexpand ($array) | |
cleanup () | |
dstfinal (&$name, &$subdir) | |
generateAppletTag ($str) | |
mkdirp ($path) | |
page_start () | |
receive_debug_log () | |
receive_uploaded_files () | |
str_applet () | |
str_jsinit () | |
tobytes ($val) | |
warning ($msg= '') | |
This class manage upload, with use of the JUpload applet. It's both a sample to show how to use the applet, and a class you can use directly into your own application.
Recommandation: Don't update its code !
By doing this, you'll be able to reuse directly any update coming from the JUpload project, instead of reporting your modifications into any new version of this class. This guarantees you that your project can use the last version of JUpload, without any code modification. We work so that the applet behavior remains unchanged, but from time to time, a change can appear.
Sample:
Notes:
Parameters:
Output generated for uploaded files:
$files is an array of array. This can be managed by (a) the function given in the callbackAfterUploadManagement class parameter, or (b) within the page whose URL is given in the afterUploadURL applet parameter, or (c) you can Extend the class and redeclare defaultAfterUploadManagement() to your needs. See the defaultAfterUploadManagement() for a sample on howto manage this array.
This array contains:
One entry per file. Each entry is an array, that contains all files properties, stored as $key=>$value. The available keys are:
Note: if you are using a callback function (i.e. callbackAfterUploadManagement) and you do not see a global 'object' you are expecting then it might have been destroyed by PHP - c.f. http://bugs.php.net/bug.php?id=39693
Definition at line 55 of file jupload.php.
|
private |
Definition at line 310 of file jupload.php.
References $msg, cleanup(), and exit.
Referenced by dstfinal(), JUpload(), mkdirp(), page_start(), and receive_uploaded_files().
|
private |
Definition at line 221 of file jupload.php.
|
private |
Definition at line 325 of file jupload.php.
References $_SESSION.
Referenced by abort(), and warning().
JUpload::defaultAfterUploadManagement | ( | ) |
Example function to process the files uploaded. This one simply displays the files' data.
Definition at line 419 of file jupload.php.
References $files, and logDebug().
Referenced by interceptAfterUpload().
|
private |
This method:
Definition at line 364 of file jupload.php.
References $dir, $ext, $name, $subdir, abort(), mkdirp(), and warning().
Referenced by receive_uploaded_files().
|
private |
Generation of the applet tag, and necessary things around (js content). Insertion of this into the content of the page. See the tag_jscript and tag_applet class parameters.
Definition at line 461 of file jupload.php.
References logDebug(), str_applet(), and str_jsinit().
Referenced by interceptAfterUpload(), and interceptBeforeUpload().
JUpload::interceptAfterUpload | ( | $str | ) |
This function displays the uploaded files description in the current page (see tag_flist class parameter)
This must be public, because it is called from PHP's output buffering.
Definition at line 483 of file jupload.php.
References defaultAfterUploadManagement(), generateAppletTag(), logDebug(), and logPHPDebug().
JUpload::interceptBeforeUpload | ( | $str | ) |
This function is called when constructing the page, when we're not reveiving uploaded files. It 'just' construct the applet tag, by calling the relevant function.
This must be public, because it is called from PHP's output buffering
Definition at line 473 of file jupload.php.
References generateAppletTag(), and logDebug().
JUpload::JUpload | ( | $appletparams = array() , |
|
$classparams = array() |
|||
) |
Definition at line 61 of file jupload.php.
References $_SERVER, $appletparams, $classparams, abort(), page_start(), and tobytes().
|
protected |
Log a message on the current output, as a HTML comment.
Definition at line 201 of file jupload.php.
Referenced by defaultAfterUploadManagement(), generateAppletTag(), interceptAfterUpload(), interceptBeforeUpload(), page_start(), and receive_uploaded_files().
|
protected |
Log a message to the PHP log. Declared "protected" so it may be Extended if you require customised logging (e.g. particular log file location).
Definition at line 214 of file jupload.php.
References $msg.
Referenced by interceptAfterUpload(), and receive_debug_log().
|
private |
Definition at line 339 of file jupload.php.
References $dir, $path, and abort().
Referenced by dstfinal().
|
private |
Definition at line 713 of file jupload.php.
References $_SERVER, $_SESSION, $files, abort(), logDebug(), receive_debug_log(), and receive_uploaded_files().
Referenced by JUpload().
|
private |
This method manages the receiving of the debug log, when an error occurs.
Definition at line 502 of file jupload.php.
References $_SERVER, $msg, exit, and logPHPDebug().
Referenced by page_start().
|
private |
This method is the heart of the system. It manage the files sent by the applet, check the incoming parameters (md5sum) and reconstruct the files sent in chunk mode.
The result is stored in the $files array, and can then be managed by the function given in the callbackAfterUploadManagement class parameter, or within the page whose URL is given in the afterUploadURL applet parameter. Or you can Extend the class and redeclare defaultAfterUploadManagement() to your needs.
Definition at line 524 of file jupload.php.
References $_SESSION, $files, $mimetypes, abort(), dstfinal(), exit, fix_dirname(), and logDebug().
Referenced by page_start().
|
private |
Build a string, containing the applet tag with all parameters.
Definition at line 282 of file jupload.php.
References $appletparams.
Referenced by generateAppletTag().
|
private |
Build a string, containing a javascript wrapper function for setting applet properties via JavaScript. This is necessary, because we use the "modern" method of including the applet (using <object> resp. <embed> tags) in order to trigger automatic JRE downloading. Therefore, in Netscape-like browsers, the applet is accessible via the document.embeds[] array while in others, it is accessible via the document.applets[] array.
Definition at line 263 of file jupload.php.
References $name.
Referenced by generateAppletTag().
|
private |
Convert a value ending in 'G','M' or 'K' to bytes
Definition at line 238 of file jupload.php.
References fix_strtolower().
Referenced by JUpload().
JUpload::uploadedfiles | ( | ) |
Return an array of uploaded files * The array contains: name, size, tmp_name, error, relativePath, md5sum, mimetype, fullName, path
Definition at line 194 of file jupload.php.
References $files.
|
private |
Definition at line 317 of file jupload.php.
References $msg, cleanup(), and exit.
Referenced by dstfinal().
JUpload::$appletparams |
Definition at line 57 of file jupload.php.
Referenced by JUpload(), and str_applet().
JUpload::$classparams |
Definition at line 58 of file jupload.php.
Referenced by JUpload().
JUpload::$files |
Definition at line 59 of file jupload.php.
Referenced by defaultAfterUploadManagement(), page_start(), receive_uploaded_files(), and uploadedfiles().