How to disable Camera option for file upload from mobile-browser?
Asked Answered
P

1

10

I am using a file type input. It should accept pdf, doc and docx file formats. So I added the following input tag -

<input type="file" accept=".pdf,.doc,.docx">

This works as expected on desktop i.e. It shows only these files on file browser. But on android devices it prompts the user to select either file browser or camera. Since we are not accepting image files I want to disable the camera option. I know the user can override the accept attribute and select any file he wishes, for this I have put javascript validation. But is there any way to disable the camera option on mobile devices? I am looking for something opposite to capture="camera".

Pomfret answered 29/1, 2018 at 14:17 Comment(1)
still there's no solution in 2023Volkman
S
-3

Try:

<input id="file-upload" type="file" accept="image/*" name="file-upload" />
Subshrub answered 28/12, 2020 at 19:6 Comment(3)
While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value.Picker
this does not solve the problem. The user wants to upload only doc/pdf files and not images.Hydrocellulose
This is doing the opposite to what is requested. The point is they dont want to upload images.Eurystheus

© 2022 - 2025 — McMap. All rights reserved.