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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:33:56+00:00 2026-05-13T06:33:56+00:00

I am trying to simulate an asynchronous file upload using an iframe. Here is

  • 0

I am trying to simulate an asynchronous file upload using an iframe. Here is my markup:

<form method="POST" enctype="multipart/form-data" name="change-avatar" action="/dyn/actions/upload?type=profile" target="target-upload">
<input type="file" name="change-avatar-input" style="position: absolute; z-index: 999; cursor: pointer; left: 10px; top: 57px; width: 147px; height: 23px; opacity: 0;"/>
<div style="position: absolute; z-index: 1000; cursor: pointer; left: 10px; top: 57px; width: 147px; height: 23px; opacity: 0;"/>
</form>
<button id="avatar-src" class="browse-button" type="button">Select File to Upload</button>

I have taken a regular button and placed an input type=file on top of it and set the opacity to 0. This input submits to a hidden iframe. The problem is the file input produces an unexpected cursor (expected being the pointer) and cannot be reliably styled. I solved this problem by placing another 0 opacity div over the 0 opacity file input and styled that to produce the correct cursor. I then set an event handler to detect a click on the 0 opacity div which in turn programmatically triggers the onclick event of the file input using click().

The problem is object.click() doesn’t seem to be supported in Firefox (works as expected in IE).

  • 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-13T06:33:57+00:00Added an answer on May 13, 2026 at 6:33 am

    Check out the Valums Ajax Upload: http://valums.com/ajax-upload/

    That component has accomplished what it appears you are trying to do… you should be able to get some good ideas there for your code (or just use the component instead).

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

Sidebar

Related Questions

I am trying to simulate a POST to a form on an external server
I am trying to simulate linux command ls using linux api from c. Looking
I am trying to simulate a session using FactoryGirl / shoulda (it worked with
I am trying to simulate a keypress for enter key in selenium using the
Using VS2008, we would like to simulate a file that has a size of
I'm trying to simulate a click on an anchor tag using jQuery. I've been
Trying to simulate a HTTP POST that needs to combine some INPUT/TEXT fields along
I´m trying to simulate a table using only CSS and DIV. The problem is
I'm trying to simulate a particle system using OpenGl but I can't get it
I'm trying to simulate some code that I have working with SQL but using

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.