-
Mar 25th, 2013, 09:10 AM
#1
Thread Starter
Hyperactive Member
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!
-
Mar 31st, 2013, 07:52 PM
#2
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|