We have updated the AjaxUploader 2.0 on 2008-10-09.
There're some important issues which have been fixed and we also added a few features based on the client requests.
1. Fixed a bug that generated 2 temporary files at server side.
2. Fixed a bug that the firefox can't now show the dialog when the scroll bar down.
3. Would not stay at 100% for a long time in good condition (Full trust)
4. Uploader.TempDirectory property is availabe now. This property allows developers set path to uploader temporary folder.
5. UploadAttachments added RemoveButtonBehavior,ActionButtonText,ActionButtonBehavior and AttachmentActionClicked/OnAttachmentRemoveClicked event.
6. We improved the client API greatly based on the client requests.
Developer can fully customize the upload UI/Behavior by using client script., including customize progress bar, the queue items table.
-----------------
The document for v2 and this new patch is not available yet. We will publish it as soon as possible. Please use the following code if you want to use the new features right away.
1. global event handler :
Developers can declare the global functions to recieve the uploader event:
For most of the functions, return false would cancel the default action.
use 'this' to get the uploader object .
<script>
function CuteWebUI_AjaxUploader_OnInitialize()
{
var hidden=this;
//warning , using the internalobject is not recommend .
//if you use it, you need test the uploader again for each new version.
var arr=[];
for(var p in hidden.internalobject)
{
arr.push(p);
}
alert("internal object member list : "+arr);
}
//fired when upload is started
function CuteWebUI_AjaxUploader_OnStart()
{
var hidden=this;
hidden.internalobject.insertBtn.style.display='none'
}
//fired when upload is stopped and not do postback
function CuteWebUI_AjaxUploader_OnStop()
{
var hidden=this;
hidden.internalobject.insertBtn.style.display=''
}
//called before the page do PostBack to server side and fire the FileUploaded event.
function CuteWebUI_AjaxUploader_OnPostback()
{
var hidden=this;
hidden.internalobject.insertBtn.style.display=''
//thie files are prepaired
//return false to cancel it..
}
//called when the insert button be clicked
function CuteWebUI_AjaxUploader_OnBrowse()
{
//return false to cancel it..
}
//called when files be selected..
function CuteWebUI_AjaxUploader_OnSelect(files)
{
//change the files array would take no effect.
var name=files[0].FileName;
var size=files[0].FileSize // (or -1)
//return false to cancel it..
}
function CuteWebUI_AjaxUploader_OnProgress(enable,filename,begintime,uploadedsize,totalsize)
{
var hidden=this;
if(enable)
{
if(totalsize)
{
document.title=filename+" - "+Math.floor(100*uploadedsize/totalsize)+'%'
}
else
{
}
}
else
{
}
return false; //hide the default ui.
}
function CuteWebUI_AjaxUploader_OnQueueUI(list)
{
var name=list[0].FileName
var size=list[0].FileSize // (or -1)
var stat=list[0].Status // Finish|Error|Upload|Queue
var func=list[0].Cancel;
//display the
//return false to hide the default queue table!
}
</script>
2. The instance handler :
As the global function, you can specify the handler on the uploader instance
by setting obj.handlexxxxx (lower case) , for example:
<script>
var hidden=document.getElementById('<%=Uploader1.ClientID%>')
hidden.handlebrowse=function()
{
var checkbox=document.getElementById("agreecheckbox");
if(!checkbox.checked)
{
alert("you must agree the contract")
return false;
}
}
</script>