Check if image on remote hosting is valid / correct

Privalov Vladimir
1 min readSep 1, 2022

Sometimes in your daily work you can meet a problem with an image hosted somewhere in cloud. Knowing whether the image is valid can be very helpful in determining the issue. Here I will show how you can easily obtain this information with well known tool curl.

curl is a popular command-line tool commonly used for transferring data using various network protocols. You can test your REST server when working on some REST API like that

curl -v -XGET <some_api_server>/users/

To get information about image you can use curl with flag -I

curl -I

Here we specify flag -l (- -list-only). This command allows to get server response with headers but without the file body.

Output will be like that

Here content-type should have value “image/jpeg”. If content-type value has some value like that “content-type: multipart/form-data; boundary=” the file is broken.