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

  • SEARCH
  • Home
  • 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 506307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:41:16+00:00 2026-05-13T06:41:16+00:00

The user will enter a customer number, then select a file to upload, then

  • 0

The user will enter a customer number, then select a file to upload, then enter a description and press the save button. However, when I check to see if they’ve selected a file, it always returns false! I’d like to know why.

Edit: I am now using form with parameter enctype=”multipart/form-data” and this is wrapped in an update panel. Both the form and update panel are in a master page

Here’s the snippet of code that error handles and is getting the HasFile() value:

else if ( ( images.Selected == true || docs.Selected == true ) && 
                  ( Upload.HasFile == false || txtInfo.Text == string.Empty ) )
        {
            if ( Upload.HasFile == false )
                lblErrorMessage.Text = "You haven't selected a file";
            else lblErrorMessage.Text = "You must enter a description";

            validated = false;
        }

And here’s the method that came from, the save button

protected void btnSaveNew_Click( object sender, EventArgs e )
    {
        bool validated = true;

        lblErrorMessage.ForeColor = System.Drawing.Color.Red;

        if ( txtCustomerNumber.Text.Length != 8 )
        {
            if ( txtCustomerNumber.Text.Length == 0 )
                lblErrorMessage.Text = "Hey! What about the customer number?";
            else if ( txtCustomerNumber.Text.Length > 8 )
                lblErrorMessage.Text = "Invalid Customer Number length (" + ( txtCustomerNumber.Text.Length - 8 ) + " char(s) too long)";
            else lblErrorMessage.Text = "Invalid Customer Number length (" + ( 8 - txtCustomerNumber.Text.Length ) + " char(s) short)";

            validated = false;
        }

        else if ( links.Selected == true && ( txtLink.Text == string.Empty || txtInfo.Text == string.Empty ) )
        {
            if ( txtLink.Text == string.Empty )
                lblErrorMessage.Text = "Hey! You forgot to enter a link!";
            else lblErrorMessage.Text = "You must enter a description";

            validated = false;
        }

        else if ( ( images.Selected == true || docs.Selected == true ) && 
                  ( Upload.HasFile == false || txtInfo.Text == string.Empty ) )
        {
            if ( Upload.HasFile == false )
                lblErrorMessage.Text = "You haven't selected a file";
            else lblErrorMessage.Text = "You must enter a description";

            validated = false;
        }

        else if ( txtInfoDesc.Text == string.Empty || txtInfo.Text == string.Empty )
        {
            if ( txtInfoDesc.Text == string.Empty )
                lblErrorMessage.Text = "You must enter an info description";
            else lblErrorMessage.Text = "You must enter info Data";

            validated = false;
        }

        if ( validated == false )
        {
            btnModify.Visible           = false;
            btnCreateNew.Visible        = false;
            ddlCustomerNumber.Visible   = false;
            btnSaveNew.Visible          = true;
            btnCancel.Visible           = true;
            txtCustomerNumber.Visible   = true;

            switch ( rblSection.SelectedIndex )
            {
                case 0: txtInfo.Visible = true;
                        txtLink.Visible = true;
                        break;
                case 1: 
                case 2: txtInfo.Visible = true;
                        Upload.Visible  = true;
                        break;
                case 3: txtInfo.Visible     = true;
                        txtInfoDesc.Visible = true;
                        break;
            }

            if ( GetCategoryIDCookie() != 0 )
                divData.Attributes.Add( "Style", "overflow:auto" );
        }
        else
        {
            addNewCustomerNumber( txtCustomerNumber.Text, txtInfoDesc.Text, txtInfo.Text );
            ddlCustomerNumber.Visible = true;
            divData.Attributes.Remove( "Style" );
            Response.Redirect( Request.RawUrl );
        }
    }
  • 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-05-13T06:41:16+00:00Added an answer on May 13, 2026 at 6:41 am

    Is there an update panel wrapped around the File Upload?

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

Sidebar

Related Questions

I have two tabitems. User will enter some data and save it on the
I have a textbox where user will enter the url of the image :
I have a delete form wherein the user will enter the pnum to be
I have a asp htmleditor where the user will enter any text or a
I'm trying to make a field where user will enter amount of time per
I have a text box that will allow the user to enter multiple authors
<input type=text id=name /> <span id=display></span> So that when user enter something inside #name,will
According to current requirement,user will upload files with large size,which he may like to
I have a small web form that user will enter some patient data and
I have a simple web page in which the user will enter some information

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.