V2 issues

Nov 8, 2008 at 10:18 PM
Thanks for releasing V2 of both uploaders.  I downloaded both projects and I migrated my code from previous version to the new one.  I have the following code in my test web page:

 

<div>

 

 

 

<fjx:FileUploader ID="FileUploader1" runat="server">

 

 

 

<ProgressBarChangeJsFunction>

 

 

<![CDATA[

 

function

(bar, percDiv, percentage, progress, loadedBytes, currentFileLoadedBytes){

 

if

(!!bar){

 

bar.style.width =

 

((progress == 0 || progress == 1) ? 0 : (progress * this.getProgressBarWidth()))+"px";

 

}

 

if(!!percDiv){

 

 

percDiv.innerHTML = (progress == 0 || progress == 1) ? "":(percentage + "%");

 

}

 

if(percentage == 100) {

 

 

document.getElementById("FileUploader2_UploadButton").firstChild.click();

 

}

}

 

]]>

 

 

</ProgressBarChangeJsFunction>

 

 

</fjx:FileUploader>

 

 

<br />

 

 

<br />

 

 

<br />

 

 

<fjx:FileUploader ID="FileUploader2" runat="server"></fjx:FileUploader>

 

 

</div>



I'm getting the following error when compiling:

Error 1 Type 'com.flajaxian.FileUploader' does not have a public property named 'ProgressBarChangeJsFunction'. C:\webapps\FlajaxianTestAjaxV2\Default.aspx 74 

Error 3 Cannot switch views: Content is not allowed between the opening and closing tags for element 'FileUploader'. C:\webapps\FlajaxianTestAjaxV2\Default.aspx 77 14 C:\webapps\FlajaxianTestAjaxV2\


Is there a similar function available to 'ProgressBarChangeJsFunction'?

Also it doesn't seem like I can include anything between the <FileUploader> tags, or am I doing something wrong?

 

Coordinator
Nov 8, 2008 at 10:26 PM
Hi maratg,

Version 2.0 does not use inline functions. The UI must be flash because player 10 has restriction not to allow browse dialog unless it is triggered by user action on flash object.

The documentation of how to customize 2.0 is coming in a few days. For now I can just tell you not to use ...JsFunction templates
Nov 9, 2008 at 4:37 PM
Those inline JsFunctions were very useful.  We're using ajax to call a webservice.  And we were using the inline JsFunctions to initiate the upload routine.  Hopefully you'll have something similar available in this new version. Thanks.
Nov 10, 2008 at 12:39 AM
Are you going to add a client side event that will fire when the file is finished uploading in Version 2?

Are we going to be able to call the upload button using script like this: "document.getElementById("FileUploader2_UploadButton").firstChild.click();" ?

Thanks.
Coordinator
Nov 10, 2008 at 3:10 AM
Edited Nov 10, 2008 at 3:12 AM

So in the latest version to trigger upload you can call
<%=FileUploader1.ClientID%>.startUpload();

The client side event is as follows:

 

<script>
function FileStateChanged(uploader, file, httpStatus, isLast){ 
      Flajaxian.fileStateChanged(uploader, file, httpStatus, isLast);
      var t = Flajaxian.$("traceTextArea"); // text area to see the result with ID="traceTextArea" 
        if(file.state > Flajaxian.File_Uploading){
                       t.value +=
"bytes:"+file.bytes+" name:"+file.name+" state:"+file.state+
                       " httpStatus:"+httpStatus+" isLast:"+isLast+"\n";
                      // state Selected = 1; Uploading = 2; Uploaded = 3; Cancelled = 4; Error = 5;
                      // here you can call uploader.cancel();
         }

</script>  

 

<

 

fjx:FileUploader ID="FileUploader1" JsFunc_FileStateChanged="FileStateChanged" runat="server">
...
</fjx:FileUploader>

 

 

 

 

 

Nov 11, 2008 at 5:29 AM
I've tried using the following code:

document.getElementById(

"FileUploader1").startUpload();

and i'm getting this error:  Microsoft JScript runtime error: Object doesn't support this property or method

here is my file uploader html code:  

 

<

fjx:FileUploader ID="FileUploader1" JsFunc_FileStateChanged="FileStateChanged" runat="server" />

 

Nov 11, 2008 at 6:21 AM
Nevermind, I didn't have the latest update of your code.  It works now.

Thanks a lot
Coordinator
Nov 11, 2008 at 7:34 AM
No problem and remember that the right code is 

<%=FileUploader1.ClientID%>.startUpload();

and not

document.getElementById("FileUploader1").startUpload();