Problem : How do I verify if an uploaded file to my server is ... let say I only allow images(JPG, PNG, GIF)... is indeed image file. Solution : Use DetectContentType function to detect the uploaded file. Only proceed further if the uploaded file is image or allowed file types. If not, abort and prompt error message. The code will assume that the target file is uploaded from client. To see how to
![Golang : How to verify uploaded file is image or allowed file types](https://cdn-ak-scissors.b.st-hatena.com/image/square/be5ffce04ea54c318beddf9a61b7d206f69fef8f/height=288;version=1;width=512/https%3A%2F%2Fd1ohg4ss876yi2.cloudfront.net%2Fsocketloop-logofb.png)