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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:25:20+00:00 2026-06-14T07:25:20+00:00

im developing an application where i need to provide two upload file options one

  • 0

im developing an application where i need to provide two upload file options one for the image and one is for video, i have this code Ref

foreach (string file in Request.Files)
{
   HttpPostedFile hpf = Request.Files[file] as HttpPostedFile;
   if (hpf.ContentLength == 0)
      continue;
   string savedFileName = Path.Combine(
      AppDomain.CurrentDomain.BaseDirectory, 
      Path.GetFileName(hpf.FileName));
   hpf.SaveAs(savedFileName);
}

and in the view

<input type="file" id="fileUpload1" name="fileUpload1" size="23" class="image" /> 
<input type="file" id="fileUpload2" name="fileUpload2" size="23" class="video" /> 

it works fine the files get uploaded but the problem is how can i determine which file comes from which input type so to differentiate between the image and the video because i have to then assign separate unique names to them and save to the database.

  • 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-06-14T07:25:21+00:00Added an answer on June 14, 2026 at 7:25 am

    You could identify the image using the content type of the HttpPostedFileBase

    if (file.ContentType.Contains("image"))
    {
        var isImage = true;
    }
    

    If you just have the one image you are sorted, you could also check for your video content type for validation. If you had two images we’d probably have to think of something else.

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

Sidebar

Related Questions

I am developing one application which need the following functionalities I have webserver. I
iam developing one application.In that i need to get the music files from the
iam developing one application.In that i need to get the how many music files
i am developing one application with map view i need display the weather depends
I have been developing the application for drawing and I need to detect double
Iam developing one application.In that iam using the uilabels.And my problem is i need
I am developing a new web application from scratch. I need to provide multi-language
I'm developing a web application, using ASP.net and C# need to provide a functionality
I'm developing an Asp.net (MVC but this doesn't really matter) application. I have a
I am developing an iPhone application where I need to provide an animation which

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.