PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, September 13, 2022

[FIXED] How to make a file field that only accept pdf and doc

 September 13, 2022     cross-platform, html, http-accept-language     No comments   

Issue

I need to accept only pdf and doc file using input type file.

<input type="file" id="test" name="test" accept="application/msword,text/plain, application/pdf"/>

This is working in windows, but in ubunthu, it only accept pdf file


Solution

Change your code to this:

<input type="file" id="test" name="test" accept=".pdf,.doc"/>

The extensions should start with a dot "." and separated by a comma ","



Answered By - Ahs N
Answer Checked By - Timothy Miller (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing