• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 359
  • Last Modified:

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" />


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

Open in new window

error.jpg
0
scm0sml
Asked:
scm0sml
  • 2
2 Solutions
 
Ajay SharmaCommented:
May be your are trying to upload files more than 4 MB in total.
If the sum of files sizes is more than 4 MB then asp.net process will not respond.

You need to modify your web.config, add maxRequestLength property in the httpRuntime node in web.config as belows:

<httpRuntime maxRequestLength="10240" />

The size needs to be mentioned in KBs, the above can handle 10 MB of post data.
0
 
scm0smlAuthor Commented:
Ah that sounds about right actually.

I will make this change later and get back to you.

Thanks
0
 
kevp75Commented:
p.s.   you can turn off pretty errors in IE to show what is actually happenning.

go to tool > internet options > Advanced tab

uncheck 'Show friendly HTTP error messages'
0
 
scm0smlAuthor Commented:
Spot on.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now