How the format is detected
Every image format begins with a recognizable signature, sometimes called magic bytes. JPEG files start with the bytes FF D8, PNG files with a fixed eight-byte header that contains the letters PNG, WebP files with RIFF followed by WEBP, and GIF files with GIF8. The file is decoded on the server, which identifies the format from these signatures and the structure that follows.
The file name plays no part. A PNG renamed to photo.jpg is still reported as PNG, which is exactly the kind of mismatch that makes upload forms and apps reject a file.
Common image formats and what they are for
JPEG is the standard for photos, using lossy compression to keep files small. PNG is lossless and supports transparency, making it the choice for screenshots, logos and graphics. WebP can do either lossy or lossless with transparency, usually at a smaller size. GIF is limited to 256 colors per frame but supports simple animation.
HEIC (HEIF) is the default camera format on recent iPhones and is not accepted everywhere. AVIF is a newer, highly efficient format. TIFF is common for scans and print work, BMP stores pixels with little or no compression, ICO holds Windows and website icons, and SVG is a vector format made of shapes rather than pixels.
Results you might not expect
Some cameras and phones save MPO files, a JPEG with extra images attached, such as a second view or depth data. They open as normal JPEGs almost everywhere. A frame count above 1 means the GIF or WebP is animated, and the color mode row shows whether the file has transparency.