FernanJC
FernanJC

Reputation: 55

iPhone Automatically Converting HEIC/HEVC Files When Using <input type="file"> — How to Prevent This?

I'm working on a web app that allows users to upload images and videos using an <input type="file"> html element. However, when iPhone users select files from the Photo Library, iOS automatically converts HEIC images to JPEG and HEVC videos to MP4. This conversion results in slower file selection and adds unnecessary overhead, and the user is "stuck" on the Photo Library selection pop-up until iOS finishes converting everything to a more "compatible format".

I've tried removing the accept attribute entirely, hoping it would prevent the conversion, but the issue persists. I would like to find a way to accept the iPhone's native formats (HEIC/HEVC) without having iOS automatically convert them. I want users to be able to upload their files without the device forcing format changes.

What I've Tried:

Using an empty accept attribute: Removing the accept attribute works for preventing restrictions on file types, but the iPhone still converts HEIC/HEVC files when selecting from the Photo Library. Setting accept="image/heic, video/hevc": I tried explicitly accepting these formats, but Safari/iOS continues to convert files. Filtering files after selection: I attempted to filter files client-side, but the iPhone still transforms them before selection.

What I Want: I want iPhones to stop converting HEIC and HEVC files and upload them in their original format. I prefer to handle any necessary conversion on the server side.

Question:

Is there a way to tell iOS not to automatically convert files in the selection process? Can the file input's accept attribute (or any other approach) prevent this automatic conversion? Are there any workarounds, or do I have to rely on just telling the user before hand that it will take a while for the Photo Library Pop-up to disappear as iOS is running some conversions.

NOTE: On iOS I can configure the Photo Library selection format from "Automatic" (which performs the conversion) to "Current". That works and forces iOS not to perform any conversions, however it requires the user to do some extra configuration steps on the website - which I am also trying to avoid if possible.


Environment:

Devices: iPhones (iOS 14+) Browsers: Safari on iOS Formats: HEIC (images), HEVC (videos)

Any help or suggestions would be greatly appreciated!

Upvotes: 0

Views: 139

Answers (0)

Related Questions