scm0sml
asked on
using multiple fileuploads causing crash
Hi,
I have the following function below.
When I only select a file from one of my 3 fileupload controls it works fine but if I select more than one I just get a crash but no error, as in my screen shot. The html is as follows:
<asp:FileUpload ID="fupImage" runat="server" /> <asp:FileUpload ID="fupImage1" runat="server" /> <asp:FileUpload ID="fupImage2" runat="server" /><asp:Button ID="btnSaveImage" runat="server" Text="Upload" />
I have the following function below.
When I only select a file from one of my 3 fileupload controls it works fine but if I select more than one I just get a crash but no error, as in my screen shot. The html is as follows:
<asp:FileUpload ID="fupImage" runat="server" /> <asp:FileUpload ID="fupImage1" runat="server" /> <asp:FileUpload ID="fupImage2" runat="server" /><asp:Button ID="btnSaveImage" runat="server" Text="Upload" />
Protected Sub btnSaveImage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSaveImage.Click
Dim fileName As String = ""
Dim reviewerEmail As String = ""
Try
reviewerEmail = HelperGeneral.GetContentByCode(Common.PageLocation.ImageReviewerEmail).WebsiteText
If fupImage.HasFile Then
fileName = Guid.NewGuid.ToString & Path.GetExtension(fupImage.FileName)
fupImage.SaveAs(HttpContext.Current.Server.MapPath("~/pendingreview/" & fileName))
'SendingEmail(fileName, reviewerEmail)
End If
If fupImage1.HasFile Then
fileName = Guid.NewGuid.ToString & Path.GetExtension(fupImage1.FileName)
fupImage1.SaveAs(HttpContext.Current.Server.MapPath("~/pendingreview/" & fileName))
'SendingEmail(fileName, reviewerEmail)
End If
If fupImage2.HasFile Then
fileName = Guid.NewGuid.ToString & Path.GetExtension(fupImage2.FileName)
fupImage2.SaveAs(HttpContext.Current.Server.MapPath("~/pendingreview/" & fileName))
'SendingEmail(fileName, reviewerEmail)
End If
JavascriptAlert("Your new image(s) will appear on the site if deemed suitable by our reviewers. Check back soon to see it live.")
Catch ex As Exception
Audit("Public website Error - Image submitted for review and errored.", Common.AuditType.Public_Website_Error, "website")
Throw
End Try
error.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Spot on.
ASKER
I will make this change later and get back to you.
Thanks