Welcome to MFU documentation!
Server side
For this part, you dont need any server side configuration.You just need an upload folder with write permissions for PHP/apache.
client side
/* upload setup */
ajaxUploadUrl : "",
uploadParameterName : "upload",
uploadValuePrefix : "uploadedFile_",
uploadTimeout : "50000",
/* progressBar setup */
progressBarMode : false,
/* UI setup */
inputWidth : 40,
progressBarWidth : "15%",
progressBarHeight : "15px",
var params = {
ajaxUploadUrl: "php/upload.php"
};
var upload = new multiplefileuploader.widget.MultipleFileUploader( params , dojo.byId("uploadContainer") );
This configuration is the one described in the Quickstart
As a standard Dijit widget, MFU can be instantiated both programmatically and declaratively To instantiate MFU programmatically, the following code snippet can be used :
var params = { ajaxUploadUrl: "php/upload.php", uploadStatusURL : "php/status.php" }; var upload = new multiplefileuploader.widget.MultipleFileUploader( params , dojo.byId("uploadContainer") );
To instantiate MFU declaratively, the following code snippet can be used :
<div dojoType="multiplefileuploader.widget.MultipleFileUploader" ajaxUploadUrl="php/upload.php" uploadStatusURL="php/status.php"> </div>
Please note that when using the declarative instantiation, the following dojo code should also be executed :
dojo.require("dojo.parser"); dojo.addOnLoad(function() { dojo.parser.parse(); });
More information can be found in dojo user manual.
MFU uses the internationalization support of dojotoolkit Please do not hesitate to contribute additional translations (Source code section). Dojo handles the locale detection automatically. For more information, please refer to dojo manual
Here is a flow diagram showing the interaction between the client-side (MFU) and the server-side (e.g. the PHP implementation provided as an example), when the ‘progressBarMode’ option is activated. In this mode, MFU will accurately report the download status by using a progress bar.
the following parameters are all overridable when instanciate MultipleFileUploader.
/* upload setup */ ajaxUploadUrl : "", uploadParameterName : "upload", uploadValuePrefix : "uploadedFile_", uploadTimeout : "50000", /* progressBar setup */ progressBarMode : true, uploadStatusURL : "", statusParameterName : "statusID", statusTimeout : "", getStatusInterval : "2000", apc_php_enabled : true, /* UI setup */ inputWidth : 40, progressBarWidth : "15%", progressBarHeight : "15px",
For instance, we want to override progressBarWidth as well as uploadTimeout :
var params = { progressBarWidth: "20%", uploadTimeout : "3000" }; var upload = new multiplefileuploader.widget.MultipleFileUploader( params , dojo.byId("uploadContainer") );
Your application can connect to MFU events using the standard dojo event mechanism.
/* triggered when a NETWORK error occured */ onError : function() { }, /* triggered when all the files in queue are uploaded */ onFinishedUploads : function() { }, /* triggered when a file is uploaded */ onFinishedUpload : function(uploadedFileInformation) { }, /* triggered when a file is being uploaded */ onAfterUploadStart : function(uploadRequest) { }
For instance, it is possible to catch the onFinishedUpload event, by using the following code snippet
dojo.connect(upload, 'onFinishedUpload', function(uploadedFileInformation) { //Here your code when a file is uploaded });