Check if image on remote hosting is valid / correct

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.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store