Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8549493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:43:37+00:00 2026-06-11T13:43:37+00:00

I’m developing a module to send emails, and one of the features is to

  • 0

I’m developing a module to send emails, and one of the features is to upload multiple files…

I used this as a reference to create it:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=68

I also had to add jquery to allow it to upload multiple files.

<script src="Scripts/jquery-1.3.2.js" type="text/javascript">
</script>

<script src="Scripts/jquery.MultiFile.js" type="text/javascript">
</script>

However, if I upload a file that is larger than 10MB when I press a button in my form (I guess it happens whenever a postback occurs), the browser cannot load the page. So what I want is to trigger this function in my button:

protected void imgBtnEnviar_Click(object sender, ImageClickEventArgs e)
{
    int intBytes = 0;
    string strArchivos = "";
    string strRutaArchivos = "";
    bool blnBytes = true;
    bool blnPermitir = true;

    try
    {
        HttpFileCollection hfc = Request.Files;

        //Check if all files together are less than 10mb
        foreach (HttpPostedFile hpf in hfc)
        {
            intBytes += hpf.ContentLength;

            if (intBytes > 11000000)
            {
                blnBytes = false;
                break;
            }
        }

        if (blnBytes)
        {
            //Upload All attached files to server
            foreach (HttpPostedFile hpf in hfc)
            {
                if (hpf.FileName == "")
                {
                    break;
                }

                string strNombre = ((int)Session["Grupo"]) + "_" + (int)Session["EmailIdCliente"] + "_" + DateTime.Now.ToString("MM-dd-yyyy_HH.mm.ss") + "_" + Path.GetFileName(hpf.FileName);
                strArchivos += strNombre + ";";
                strRutaArchivos += Server.MapPath("~/Archivos/") + strNombre + ";";
                hpf.SaveAs(Server.MapPath("~/Archivos/") + strNombre);
            }
        }
    }

    catch
    {
        blnPermitir = false;
    }

    if (!blnBytes || !blnPermitir)
    {
        //Error Message Displayed To User
        ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "alert('Maximo Puede Enviar 10MB En Archivos');", true);
    }

    else
    {
        //Moving on to send email
    }
}

What I want is that if blnBytes equals false (it becomes false when all combined files are more than 10mb) it just displays an error message, but how can I make it work even if a single file is larger than 10mb??….

Hope you can help me with that
thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:43:39+00:00Added an answer on June 11, 2026 at 1:43 pm

    You have to enable large file support in web.config (httpRuntime, maxRequestLength parameter).

    Here is sample:

        <httpRuntime requestValidationMode="2.0"
         executionTimeout="6000"
         maxRequestLength="20485760"
         requestLengthDiskThreshold="80"
         useFullyQualifiedRedirectUrl="false"
         minFreeThreads="8"
         minLocalRequestFreeThreads="4"
         appRequestQueueLimit="5000"
         enableKernelOutputCache="true"
         enableVersionHeader="true"
         requireRootedSaveAsPath="true"
         enable="true"
         shutdownTimeout="90"
         delayNotificationTimeout="5"
         waitChangeNotification="0"
         maxWaitChangeNotification="0"
         enableHeaderChecking="true"
         sendCacheControlHeader="true"
         apartmentThreading="false" />
    

    More about this can be found here:
    http://msdn.microsoft.com/en-us/library/e1f13641(v=vs.71).aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.