Results 1 to 2 of 2

Thread: asyncFileUpload.UploadedFileError occurs on page partial post back

  1. #1

    Thread Starter
    Hyperactive Member jasonwucinski's Avatar
    Join Date
    Mar 2010
    Location
    Pittsburgh
    Posts
    452

    asyncFileUpload.UploadedFileError occurs on page partial post back

    I hope someone will respond. I have a control that has an update panel (set to conditional updates) that has an asyncfileupload control in it. The controls works fine at first, but if I upload a file, then cause its update panel to update, the asyncfileupload.UploadedFileError will fire without it or asyncFileUpload.UploadedComplete ever being called. Here is how I create my control:

    Code:
    Public Class FileUpload
        Inherits ScriptControl
        Implements INamingContainer, IPostBackEventHandler
        Private WithEvents asyncFileUpload As AjaxControlToolkit.AsyncFileUpload
    ....
    
     asyncFileUpload = New AjaxControlToolkit.AsyncFileUpload
     With asyncFileUpload
        .ClientIDMode = UI.ClientIDMode.AutoID
        .UploadingBackColor = ColorTranslator.FromHtml(UploadingBackColor)
        .CompleteBackColor = ColorTranslator.FromHtml(CompleteBackColor)
        .UploaderStyle = AjaxControlToolkit.AsyncFileUpload.UploaderStyleEnum.Traditional
        .ThrobberID = img.UniqueID
     End With
    'then the control gets added to a Panel.  
    'events:
    Protected Sub fileUploadFailure(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles asyncFileUpload.UploadedFileError
    
    'do stuff
    end Sub
    
     Protected Sub SaveUploadedFile(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles asyncFileUpload.UploadedComplete
    
    'do stuff
    End Sub


    As I mentioned, the control works fine when uploading a file. But I have a linkbutton in the same control that allows the user to download the uploaded file (causing the control's update panel to update). When this occurs, the fileUploadFailure event fires for no apparent reason (as no upload has taken place). Can anyone explain what is happening and how to prevent this?


    FYI: The error that comes back from the status message is:
    "The File Attached Has An Invalid File name" and the state code = 2
    if i was able to help, rate my post!

  2. #2
    Frenzied Member brin351's Avatar
    Join Date
    Mar 2007
    Location
    Land Down Under
    Posts
    1,293

    Re: asyncFileUpload.UploadedFileError occurs on page partial post back

    I don't use update pannels but as the file upload seams to fire on the linkbut click and the error seams to indicate that no file was present (could try adding a file path then clicking the linkBut) perhaps test for filetype before running the fileupload code. That's a lot of guesses sorry.
    The problem with computers is their nature is pure logic. Just once I'd like my computer to do something deluded.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width