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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:15:10+00:00 2026-05-15T18:15:10+00:00

I am trying to make a server page (C#, asp.net 2.0+) to save an

  • 0

I am trying to make a server page (C#, asp.net 2.0+) to save an uploaded file from another page.

Specifically,
I have an HTML page with a

<form action="upload.aspx"> 

and I can’t figure out how to handle saving the file on the server in upload.aspx.

I found a few examples (one being: http://msdn.microsoft.com/en-us/library/aa479405.aspx)
but that requires the <input type=file> element to be on the same page.

I am having difficulties with grabbing the posted file on my upload.aspx page.

Anyone have any pointers? How can I grab a posted file in aspx and save it to the server when the file is posted from another page?

Many thanks,
Brett

  • 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-15T18:15:11+00:00Added an answer on May 15, 2026 at 6:15 pm

    1.Create Uploadfile.aspx, code as below:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Uploadfile.aspx.cs" Inherits="Uploadfile" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>File Upload Control</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <asp:FileUpload  runat="server" ID="fuSample" />
        <asp:Button  runat="server" ID="btnUpload" Text="Upload"
                onclick="btnUpload_Click" />
                <asp:Label runat="server" ID="lblMessage" Text=""></asp:Label>
        </div>
        </form>
    </body>
    </html>
    

    2.create Uploadfile.aspx.cs, code as below:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    public partial class Uploadfile : System.Web.UI.Page
    {
      protected void Page_Load(object sender, EventArgs e)
      {
      }
      protected void btnUpload_Click(object sender, EventArgs e)
      {
        //Files is folder Name, make sure it exists
        fuSample.SaveAs(Server.MapPath("/Files") + "//" + fuSample.FileName);
        lblMessage.Text = "File Successfully Uploaded";
      }
    }
    

    3.create a new file: demo.html, code shown as below, (embed the Uploadfile.aspx in Your Html page using iframe)

    <h3>Demo</h3>
    <iframe height="40" width="700" src="Uploadfile.aspx">
    </iframe>
    

    4.visit /demo.html, now you can be able to upload your file from html itself,by using UploadFiles.aspx

    enter image description here

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

Sidebar

Related Questions

I am trying to make an HttpWebRequest from an ASP.Net page on a server
I have an ASP.NET page that gets a list of game server ip addresses
In an ASP.NET MVC aspx page I have the following script: <script type=text/c# runat=server>
I am writing a webapplication in ASP.net. I am trying to make a file
I am currently working in ASP.Net / C#. I am trying to make the
Im already 5 days trying to make jquery drag and drop with asp.net c#
I am trying to make a simple web application using ASP.NET and Interop COM.
In summary : I have an ASP.NET web page that causes an AJAX postback
I am trying to make an RSS Feed with asp.net,sql and xml. I am
I have an ASP.Net page that has a button that when clicked I would

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.