I've built an HTML web form for the purpose of uploading files. When accessed from an iOS device, non-image files (.pdf, .docx, etc.) appear greyed-out when the "Browse" button is chosen to select a file from the iOS file explorer.
I have a fully-featured page (HTML, CSS, JS, PHP), but I've stripped the whole page down to the simplest form element to test functionality. Here's an example of code that does not work on my server (this is all that's in the HTML file besides the boilerplate tags), when viewed on a device running iOS 12.3:
<form action="" enctype="multipart/form-data" method="post">
<input type="file" accept="image/*, .heic, .hevc, .heif, .pdf, .png, .gif, .jpg, .jpeg, .doc, .docx, image/png, image/jpg, image/jpeg, image/gif, application/msword, application/pdf" multiple>
</form>
You can see a similarly simple working example of non-image files being selectable from an iOS device with one of the W3School's "Try It" editors:
https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_type_file
Something is causing W3School's and other sites' servers to behave differently than mine when working with forms on iOS.
What is the factor on iOS that determines which sites/forms are able to select non-image files for an upload?
Cause A: The document is corrupted Your file may be corrupted, which means there are metadata issues in the file that occurred during original document generation, scanning, or some other conversion process, has produced an invalid PDF (i.e., one that doesn't conform to PDF structure standards).
If you're trying to open a PDF on an iPad or iPhone and it appears blank, you need to set Adobe Reader as your default for opening PDF files on your device.
You must remove image/*
and the other image/
file types.
<form action="" enctype="multipart/form-data" method="post">
<input type="file" accept=".heic, .hevc, .heif, .pdf, .png, .gif, .jpg, .jpeg, .doc, .docx, application/msword, application/pdf" multiple>
</form>
Here is a sample of your code with my corrections: https://codepen.io/VladimirButakov/pen/XvXxGq?&editable=true
I made a web page that can get pdf files and send them to chats over a telegram bot. I opened the web page from my Iphone and just selected a pdf and sended it and it worked just fine.
The code I used for the input file is the following.
<form action="inviapdf.php" enctype="multipart/form-data" method="post" class="inputfile">
<input accept=".png, .jpg, .jpeg" class="bott" type="file" name="pdf"/>
<button>SendPDF</button>
</form>
I have an Iphone 7+ with latest IOS release. If I didn't answer your question can you be a bit more specific about it? thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With