TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
chrishornberger
NA
277
0
Upload question...
Oct 1 2003 1:54 PM
Assuming I've got an ASPX form containing the code listed below. Am I missing something? I was under the impression that locally browsing to a file and hiting the submit buttion would just kind of automagically do it. Am I incorrect? (note, yes I know I don't go any further than simply grabbing the filename in this example, it's good enough to prove my point). [code] <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="uploadapp.WebForm1" %>
WebForm1
[/code] And the code behind looks like: [code] using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace uploadapp { ///
/// Summary description for WebForm1. ///
public class WebForm1 : System.Web.UI.Page { protected System.Web.UI.WebControls.Button Button1; private void Page_Load(object sender, System.EventArgs e) { if( Request.Files.Count > 0 ){ HttpPostedFile postedfile = Request.Files[0]; string strFileName = postedfile.FileName; } else { Response.Write( "no files" ); } } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } ///
/// Required method for Designer support - do not modify /// the contents of this method with the code editor. ///
private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion } } [/code]
Reply
Answers (
1
)
Chat Application
Replicating Content