using multiple fileuploads causing crash

Posted on 2011-05-09
Last Modified: 2012-05-11

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

            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")
        End Try

Open in new window

Question by:scm0sml
    LVL 18

    Accepted Solution

    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 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.

    Author Comment

    Ah that sounds about right actually.

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

    LVL 25

    Assisted Solution

    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'

    Author Closing Comment

    Spot on.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
    I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now