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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:45:06+00:00 2026-05-26T18:45:06+00:00

I’m working on a page that will allow a user to upload a photo

  • 0

I’m working on a page that will allow a user to upload a photo with an HTML Input:

<input id="fileUpload" runat="server" type="file"   style="visibility:hidden;" />

I’ve got it hidden because I want to style my own upload control by using an <img> for the Browse button and using Jquery to trigger the fileUpload control’s click event:

<img id="btnBrowse" alt="Choose an photo to upload..." src="images/browse.gif" />

JS:

$("#btnBrowse").click(function () {

 $('input[type=file]').click();

});

I’m using an <ASP:ImageButton> for the Upload button and an <ASP:TextBox> to hold the text of the file chosen.

If I remove the style="visibility:hidden;", everything works fine. But with it, when I click Upload, the file upload control’s file is lost, and the page won’t post back until I click Upload a second time.

I know that this is kind of a “hack” but I don’t want to use an <ASP:FileUpload> control because it can’t be customized and I didn’t want to bother with a Jquery plugin if I can accomplish what I need without one.

Has anyone experienced this or have any idea how I could make this work while keeping style="visibility:hidden;" in place?

Many thanks in advance!

EDIT:

It actually appears to be more related to my custom “Browse” button. I was using an <img> as noted, and I’ve tried using an <ASP:ImageButton> but get the same results. Anytime I click my custom Browse button (which calls JS to click the input type=file), after a file is chosen, my Upload button will require two clicks (And the first click wipes out the filepath of the input (like it tries to post back)?

Any thoughts on 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-05-26T18:45:06+00:00Added an answer on May 26, 2026 at 6:45 pm

    If I understand correctly, you can attach an event to the browse image in code behind. I’ve done the same when adding multiple attributes to buttons, ie. an onclick point to code behind and an onchange pointed to js.

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

Sidebar

Related Questions

I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I need a function that will clean a strings' special characters. I do NOT
I am using Paperclip to handle profile photo uploads in my app. They upload
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

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.