Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

495
Views
custom file input button, creating an invisible input file type inside div inside button for file input

I would like to make a file input button like the one in Amazon write a review pictured below

amazon upload button

How is it possible that the entire button opens up the file dialog on click if the input file type is hidden?

amazon upload photo button code

My code here hides the input file type button but does not open the file dialog. It is using React with tailwind classes

    <button
      type="button"
      className="p-6"
    >
      <div aria-label="Add a photo">
        <HiOutlinePlus className="text-4xl" />
        <input type="file" accept="image/*" className="hidden" />
      </div>
    </button>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

How is it possible that the entire button opens up the file dialog on click if the input file type is hidden?

The probably use a separate widget that then opens the hidden file input on click, as follows:

function openFileUpload() {
  document.getElementById("hiddenFile").click();
}
<button onclick="openFileUpload()" type="button">Visible Button</button>
<input type="file" id="hiddenFile" style="visibility:hidden">

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!