It took me some time to get this right as I couldn't find an easy-to-follow example on the web. Since this is a common use case, this post may hopefully help someone. This example has a single template for the main webpage that has the file upload form. The backend handler serves this template on a GET request and handles the upload on a POST request. If you're not familiar with Go's html template