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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:50:44+00:00 2026-05-21T18:50:44+00:00

For reasons beyond this question, I cannot have a form on this page with

  • 0

For reasons beyond this question, I cannot have a form on this page with a runat="server" attribute.

How do I go about accessing an uploaded file uploaded using a regular <input type="file"...?

This question touches on the issue, (using an <input type="file" rather than an <asp:FileUpload), however they still both runat=server.

The types of things I would like to be able to acheive (server side, after the form has been posted), include:

  • if (MyInput.HasFile) ...
  • var fileName = MyInput.FileName;
  • var fullPathAndFile = MyInput.PostedFile.FileName;
  • var mimeType = MyInput.PostedFile.ContentType;

I’m sure all of this stuff can be done, I’m just used to .NET taking care of all of this for me!

Update: after the insightful comments below, I seem to be doing things in an odd manner…

I was originally looking for something along the lines of:

HttpPostedFile file = Request.Files["myFile"];
//accessing the file without having the element itself being runat="server", e.g. manually through the Request.
//(I know this doesn't work without runat="server", just an example to clarify my question)

//if(MyFile.HasFile) ...
if (file != null && file.ContentLength) ...

//var fName = MyFile.FileName
var fName = Path.GetFileName(file.FileName);

But it seems that even that requires runat="server"

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

    This question seems a little confused.

    First off, what do you mean about having another form on a page? ASP.NET pages should have exactly one form (with or without runat="server").

    This wording makes me think you have another issue that should be addressed first. It’s extremely unusual to have a valid reason for more than one form on an ASP.NET page.

    But if this is what you really need, then remove the ASP.NET tags to your question and replace them with HTML as this would have nothing to do with ASP.NET.

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

Sidebar

Related Questions

I asked this question about reasons to use Drupal 7's Forms API as opposed
For reasons that are irrelevant to this question I'll need to run several SQLite
I'll preface this question by stating I have historically used tables for my HTML
I have a column in my oracle database which due reasons beyond my control
Related to this question , how do I detect that a form user is
For reasons beyond the scope of this post, I would like to verify in
For reasons beyond the scope of this post, I would like to verify in
I have an ETL process that is, for this question's purpose, done entirely in
For reasons beyond my control, I need to return const char* from a function,
Any reasons why this can not be standard behavior of free() ? multiple pointers

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.