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 6138661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:53:39+00:00 2026-05-23T17:53:39+00:00

For the sake of simplicity, I have a simple 2 panel multiview. On the

  • 0

For the sake of simplicity, I have a simple 2 panel multiview. On the first there’s an FileUpload control and, on the second, a button that sends an email with the file as an attachment. When I check “FileUpload1.HasFile” on second tab it comes back as false. And if I go back to View 1, all states for every other control has been properly maintained except for the fileupload wich is blank.

<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
    <asp:View ID="Step1" runat="server">
      <asp:FileUpload ID="FileUpload1" runat="server" Width="450" EnableViewState="true" />
    </asp:View>
    <asp:View ID="Step2" runat="server">
      <asp:Button ID="btnSubmitForm" runat="server" Text="Submit Data" onclick="btnSubmitForm_Click" />
    </asp:View>
</asp:MultiView>

When user navigates to View 2 and clicks the button:

//Initialize smtp server
            SmtpClient smtp = new SmtpClient("myHost");

            //Initialize mail message object
            MailMessage mail = new MailMessage();

//Set all mail message params (to, cc, subject etc...)

//attach file, this is where it fails to recognize the attached document. bool is false :(
if (FileUpload1.HasFile)
{
mail.Attachments.Add(new Attachment(FileUpload1.PostedFile.InputStream, FileUpload1.FileName));
}

any ideas???

  • 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-23T17:53:40+00:00Added an answer on May 23, 2026 at 5:53 pm

    File Uploads are considered security sensitive. When a user picks a file to upload, the form submit will have to take place before any other redirects. To have the browser allow the value to be “restored” from state could lead to the old days of file fishing. This is where a site would have a form with a hidden file upload control with a pre-populated value. When the user submitted the form, the browser would upload the file too, if it existed.

    Modern security standards block these attempts. If you want the user to upload a file, you can’t navigate to a new page. You can either redesign to do everything on one page, or take the uploaded file during page navigation, store it to some temp location, return a unique id to the new page and on submission of that page tie the two together. And implement a cleanup for people who click back or just don’t proceed with the second page.

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

Sidebar

Related Questions

I have an NSMutableArray that is populated with objects of strings. For simplicity sake
For the sake of simplicity, let's say that we have input strings with this
For the sake of simplicity say I have multiple Xtext DSLs that all describe
I have custom control written in Java. For the sake of simplicity lets assume
for the sake of simplicity let's assume that I'm making a simple Pong clone
I have a simple Entity Framework. For simplicity's sake I will transform the entity
Suppose you have a standard org hierarchy table in Oracle. For simplicity sake, assume
I have a dilemma. Let's assume(for simplicity's sake) I have four tables, with different
I'm modelling a cube that contains inventory data. For simplicity's sake we are trying
I have a table whose records represent certain objects. For the sake of simplicity

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.