FileReceived event handler problem

Dec 1, 2008 at 1:24 PM
Hello,

I am not able to change any of the controls on the page with the code written in FileReceived handler. All in want to do is set the value of one hidden field to be equal to the name of uploaded file, but it's not working.

I browsed the FileUploader source, and commented the line where it ends the response (line 530 in FileUploader.cs), but the problem is still there. Seems like I can not make any changes to the page if the postback control is FileUploader...

Any ideas?

Thanks.
Dec 1, 2008 at 4:04 PM
Since this is an ajax and flash control, there is no postback, so you can't modify the page. There are client-side javascript functions; browse the docs for examples, but that's how you'd have to handle that.
Coordinator
Dec 1, 2008 at 4:43 PM
Tucker is right.

Here is what you can do:

<script>
function FileStateChanged(uploader, file, httpStatus, isLast){
    Flajaxian.fileStateChanged(uploader, file, httpStatus, isLast);
    
   // if file is uploaded (file.state == 3) or if there is an error (file.state == 5)
    if(file.state > Flajaxian.File_Uploading){
         Flajaxian.$("<%=MyHiddenField.ClientID%>").value = "Tralala";
    }
}
</script>
<fjx:FileUploader JsFunc_FileStateChanged="FileStateChanged" runat="server" >
    <Adapters>
        <fjx:FileSaverAdapter Runat="server" FolderName="UploadFolder" />
    </Adapters>
</fjx:FileUploader>