Menu

Why Your Image Upload Works With JPG but Fails With HEIC
📰

Why Your Image Upload Works With JPG but Fails With HEIC

DEV Community: frontend·Ethan Carter·3 days ago
#bA34xocL
#devtofrontend#devto#dev#file#heic
Reading 0:00
15s threshold

A profile-photo form works perfectly with your JPG test image. Then someone selects a photo from their iPhone, and the preview stays empty.

The file may be perfectly valid. Your upload workflow may simply depend on image support that is different from the support on the user's device.

HEIC makes this easy to notice. A photo can open normally in one application and fail at a later step in another. Fixing the experience starts with identifying which step actually failed.

Selecting a file does not mean the browser can decode it

A typical file input looks straightforward:

<label for= "photo" > Choose a photo </label> <input id= "photo" name= "photo" type= "file" accept= "image/*" />

Enter fullscreen mode

Exit fullscreen mode

The accept attribute helps guide the file picker. It does not add an image decoder, convert a selected file, or validate its contents.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.