FileStateChanged event fires twice for each selected item.

Jan 24, 2011 at 8:48 AM
Edited Jan 24, 2011 at 9:55 AM

Hello

Im experiencing a strange problem. Im using the control to upload a lot of images to the server and creating an entry in a db. The FileStateChanged event fires twice for each image im selecting, so the image gets saved twice to my server and db.

Heres my code:

Aspx:

 <script type="text/javascript">
        function FileStateChanged(uploader, file, httpStatus, isLast) {
             Flajaxian.fileStateChanged(uploader, file, httpStatus, isLast);
             if (file.state > Flajaxian.File_Uploading && isLast) {
                 alert('Your pictures have been uploaded to Iconzoomer.');
             }
         }
    </script>

 <fjx:FileUploader ID="FileUploader1"  
                        OnFileReceived="FileUploader_FileReceived" 
                        AllowedFileTypes="Web Images (Jpeg, Gif, Png):*.jpg;*.jpeg;*.png;*.gif"  
                        JsFunc_FileStateChanged="FileStateChanged"
                        runat="server">
                    </fjx:FileUploader>
Codebehind:
 Protected Sub FileUploader_FileReceived(ByVal sender As Object, ByVal e As FileReceivedEventArgs) Handles FileUploader1.FileReceived
        Dim extension As String = e.File.FileName.Split(".")(1)
        Dim entry As New AssignmentEntryEntity
        entry.AssignmentId = Session("assignmentid")
        entry.Extension = extension
        entry.OrgTitle = e.File.FileName
        entry.Sender = "website"
        entry.Tags = ""
        entry.Uploaded = DateTime.Now
        entry.UserId = Session("userid")
        Dim imgId As Integer = Syncrowd.BusinessLayer.BusinessLogic.AssignmentEntries.InsertAssignmentEntry(entry)
        'Dim stream As System.IO.Stream = e.File.InputStream
        e.File.SaveAs(System.Configuration.ConfigurationManager.AppSettings("entriesPath") & "\" & imgId & "." & extension)
    End Sub

Any suggestions to what might be causing this behaviours is very appreciated.
Thanks in advance
Dennis Francek