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

129
Views
How to make input accept certain extension?

Any idea how to make an input accept certain files extensions like pdf, online? so the can show in the box when picking instead of showing all files or custom files?

<input
    accept='.Online'
    className={classes.input}
    id='contained-button-file' /*multiple*/
    type='file'
    onChange={fn} />
<label
    htmlFor='contained-button-file'
    className={classes.root}
    style={{ marginTop: 'auto', marginBottom: 'auto' }}>
    <Button
        startIcon={<PublishIcon />}
        variant='contained'
        color='primary'
        component='span'>
        upload
    </Button>
</label>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can externally define accept props to input so that It will accept only the input type that you have specified as a comma-separated values:

The accept attribute value is a string that defines the file types the file input should accept. This string is a comma-separated list of unique file type specifiers. Because a given file type may be identified in more than one manner, it's useful to provide a thorough set of type specifiers when you need files of a given format. - MDN

You should read accept Docs

<input
    id='contained-button-file' /*multiple*/
    type='file'
    accept=".pdf,.Online"
    onChange={fn} />
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!