Is there a way to find out the MIME type (or is it called "Content-Type"?) of a file in a Linux bash script?
The reason I need it is because ImageShack appears to need it to upload a file, as for some reason it detects the .png file as an application/octet-stream
file.
I’ve checked the file, and it really is a PNG image:
$ cat /1.png
?PNG
(with a heap load of random characters)
This gives me the error:
$ curl -F "fileupload=@/1.png" http://www.imageshack.us/upload_api.php
<links>
<error id="wrong_file_type">Wrong file type detected for file 1.png:application/octet-stream</error>
</links>
This works, but I need to specify a MIME-TYPE.
$ curl -F "fileupload=@/1.png;type=image/png" http://www.imageshack.us/upload_api.php