Public functions

Functions

The main Real Uploader Class provides public function that can be called.

Public functions

List of public function and parameters

  • stopUpload() Stop the upload
  • enable(bool) Enable/Disables the uploader
  • on(event, callback, scope) Bind new callback to an event. Scope is optional. Events can be namespaced.
  • off(event) Remove all callbacks for a specific event. If namespace is present will remove only events matching
  • clearQueue() Removes all queue files for upload, clean the list
  • hasFiles() Check if there are files selected. Returns boolean.
  • isIdle() Check the status of the uploaders. Returns true if it is ready for upload.
  • isUploading() Returns true if upload is taking place.
  • getPendingFiles() Returns an array with the pending files ready to be uploaded.
  • startUpload() Starts the upload of all files.

Example of using public the functions:

                        <div id="targetElement"></div>
    <script type="text/javascript">
        var uploader = new RealUploader("#targetElement");
        uploader.startUpload();
        uploader.stopUpload();
        uploader.enable(false);//disables the uploader
        uploader.on("start", function(){
            console.log("Upload start");
        }, undefined);
        uploader.on("md5Done.myevent", function(){});
        uploader.on("md5Done.yourevent", function(){});
        uploader.off("md5Done.yourevent");//this will remove the upper event only

        uploader.clearQueue();
        var hasFiles = uploader.hasFiles();//true or false
        var isReadyForUpload = uploader.isIdle();
        var isUploading = uploader.isUploading();
        var filesToBeUploaded = uploader.getPendingFiles();
    </script>
    
                    

* To be note that all functions of RealUploader are public (Javascript) but only the above functions are made to be called as public functions.