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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:55:04+00:00 2026-06-02T21:55:04+00:00

I am using input type=file, Now my requirement is that I only want to

  • 0

I am using input type=”file”, Now my requirement is that I only want to select png images, that is when I select browse a “png” filter should be applied.

I have referred www.w3schools.com/tags/att_input_accept.asp and below is the code I am using, this works fine with Chrome but does not work with Firefox and IE.

Please can anyone help me understand what wrong I must be doing ?

 <h2>Below uses accept="image/*"</h2>
 <input type="file" name="pic1" accept="image/*" /> 

 <h2>Below I need to accept only for png</h2>
 <input type="file" name="pic1" accept="image/png" /> 

​Here is a fiddle link to it http://jsfiddle.net/Jcgja/2/

  • 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-02T21:55:05+00:00Added an answer on June 2, 2026 at 9:55 pm

    You need to validate it through java script. Below is the code for java script validation

    function CheckFileName() {
            var fileName = document.getElementById("uploadFile").value
            if (fileName == "") {
                alert("Browse to upload a valid File with png extension");
                return false;
            }
            else if (fileName.split(".")[1].toUpperCase() == "PNG")
                return true;
            else {
                alert("File with " + fileName.split(".")[1] + " is invalid. Upload a validfile with png extensions");
                return false;
            }
            return true;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am styling an Input File type using only CSS, and it works on
I have a problem in PHP. I am using <input type=file> to get the
I am trying to use a input type=file for the user to select the
I'm using the jQuery validation plugin. On most of my input type... tags I
When I was still using PrimeFaces v2.2.1, I was able to type unicode input
I have a Windows/Apache2/PHP app that receives file using chunked encoding. The reason is
I am able to generate a link using my file upload system, now after
When reading data from the Input file I noticed that the ¥ symbom was
I am generating the html using JSON file. Now I need to pass data
hi guys i am uploading the images using the @PhP file upload Method @

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.