File Uploaded Problem

Jul 17, 2009 at 10:07 AM
Edited Jul 20, 2009 at 11:05 AM


Having tested and implemented the control in several ways now (e.g. with UpdatePanel, without UpdatePanel on it's own) and also used this forum to overcome any difficulties like the Flash debugging etc, there definitely appears to be a problem with handling files uploaded. The following threads are probably all experiencing the same...

There was another thread which I've not been able to find right now and in that, flajaxian explains that the filereceived event is fired when the file leaves the client and not when it is placed on the server which can mean any server-side actions will not necessarily see the file uploaded. This is not good if you are planning to do something with the file when it is uploaded, like display to the browser.

Does anyone know of any other way to handle files uploaded.


edit: I've now found the thread I mention above and there still appears to be no solution...


Jul 21, 2009 at 4:16 PM
Edited Jul 21, 2009 at 8:34 PM

Well as no-one seemed to have a solution to this or are extremely busy, I did some more investigation and thought it would be useful to share my solution. The problem stems from the fact the server-side routine for saving the file runs after the client-side routine for filestatechanged so I had to implement a way to pass the full file list to the server from the client, I found the best way to do this would be to use a query string to display all of the files as an array, then when the new page opens, the query string can be read as an array and processed accordingly from the server using server code, hopefully the code below will help which is done in but should be easy enough to convert to C#. The below example assumes the page to redirect to is called DisplayFiles.aspx

HTML and javascript for upload page

<script type="text/javascript">
        function FileStateChanged(uploader, file, httpStatus, isLast) {
            Flajaxian.fileStateChanged(uploader, file, httpStatus, isLast);
            var FileList = Flajaxian.$("FileList");
            // Add each file name to the div with an ID of "FileList"
            if (file.state > Flajaxian.File_Uploading) {
                FileList.innerHTML += "&FileName=" +;
            // If last file, then redirect to page for displaying files
            if (file.state > Flajaxian.File_Uploading && isLast) {
                document.location.href = "DisplayFiles.aspx?FileName=" + + FileList.innerHTML.replace(/\&amp;/g, '&');

<fjx:fileuploader id="FileUploader" runat="server" onfilereceived="FileReceived"
        <div id="FileList" style="display: none;"></div>

Code for upload page

Public Sub FileReceived(ByVal sender As Object, ByVal e As com.flajaxian.FileReceivedEventArgs) Handles FileUploader.FileReceived


End Sub

Code for page which displays the files 

Protected Sub Page_LoadComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadComplete

    If Not Page.IsPostBack Then
         Dim FileList As String() = Request.QueryString.GetValues("FileName")
         For i = 0 To UBound(FileList)
              ' Process file list items from here
              ' FileList(i) will return the name of each file
              ' e.g. ListBox.Items.Add(FileList(i))
    End If

End Sub

I hope that helps anybody else who suffers from the same problem, as my first post suggests, I think a lot of people could be experiencing this problem.

PS. I would just like to add that I would highly recomend this control, now the above has been solved it's exactly what I needed, good work flajaxian!!