Table Of Contents
 

Proflash Upload - Javascript

Starting the Upload from Javascript


You can integrate the PFU into your form and start the upload when the submit button is clicked
using the following code.

Sample code

var flash;
            if(navigator.appName.indexOf("Microsoft") != -1) {
                flash = window.ProFlashUpload1;
            }else {
                flash = window.document.ProFlashUpload1;
            }
            flash.upload();

Tip: Use the showUploadButton="no" option to hide the built-in upload button on ProFlashUpload

Javascript Callbacks


ProFlashUpload can call your javascript functions with a report after each file has uploaded (or failed to) and when all files have finished uploading using attributes jsOnFileUpload and jsOnComplete

jsOnFileUpload


Use the jsOnFileUpload attribute to pass ProFlashUpload the name of the Javascript function to call after each file has finished uploaded or after a file has failed to upload. Your Javascript function should be in the following format:
function onFileUpload( fileNo, bSuccess, fileName ){
alert("File #" + fileNo + "," + fileName + (bSuccess?" failed":" uploaded") );
}

jsOnComplete


Use the jsOnComplete attribute to pass ProFlashUpload the name of the Javascript function to call when all files have been uploaded. Your Javascript function should be in the following format:

function onComplete( numFiles, numSuccessful, numFailed ){
if( numSuccessful == numFiles ) alert("All " + numFiles + " files uploaded.");
else alert( numFailed + " files failed to upload." )
}