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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:51:06+00:00 2026-06-10T12:51:06+00:00

I have imlepmented file upload with one button i have taken one button and

  • 0

I have imlepmented file upload with one button
i have taken one button and one file upload control and on clicking the button i am opening file upload for browsing file,

after selecting file i have to submit the form, the problem is arising when i click on submit,the file upload gets empties and i got HttpPostedFileBase null in my controller,but when i directly use file upload control(ie clicks on its browse button) its working fine

Below is my code

  $(document).ready(function () {
        $("#btn").click(function () {
            $("#logup").click();
            $("#logup").select();
            return false;
        });

    });




<input type="button" id="btn" value="Choose file" />
<input type="file" id="logup" name="logofile" style="display:none" />


<button type="submit">Submit</button>

2nd i also wants to show file name after selecting the file, besides my btn how can i do this?

  • 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-10T12:51:08+00:00Added an answer on June 10, 2026 at 12:51 pm

    Answer To Question 1

    Below is a form with two submit buttons. Note that both these submit buttons have the same name i.e “submitButton”

    @Html.BeginForm("MyAction", "MyController"); %>
    <input type="submit" name="submitButton" value="Button1" />
    <input type="submit" name="submitButton" value="Button2" />
    }
    

    Now over to the Controller, the Action takes in an input parameter called string stringButton and the rest is pretty self-explanatory.

    public ActionResult MyAction(string submitButton) {
            switch(submitButton) {
                case "Button1":
                   // do something here
                case "Button2":
                   // do some other thing here
                default:
                    // add some other behaviour here
            }
    ...
    }
    

    Answer To Question 2

    You will be getting fileName from HttpFilePostedBase object, but since you dont want a post back, you can create an action thats return this value as JSON

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

Sidebar

Related Questions

I have just implemented an Ajax File Upload control that uses a progress bar.
I have one desktop application which was implemented in C#. This app uploads file
I have implemented a file transfer rate calculator to display kB/sec for an upload
So I have a UIWebView implemented in one .m file and a UITableView implemented
Hello I'm doing file upload with Yii. I have implemented this way and it
I have implemented fileupload functionality using apache commons file upload library and implemented logic
I have implemented a simple file upload-download mechanism. When a user clicks a file
I have implemented a basic file upload/download on top of AppEngine datastore. The functionality
I have implemented upload feature in ASP.MVC. I am using jQuery.BlockUI and JQuery.Form plugins
I am trying to upload a text file with more than one record but

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.