#File
3 articles
18 How to Download File in Golang
Download Files
Apart from uploading files, we also need or need a page that can download files or something on our website. The Golang library provides FileServer
and ServeFile
. If we want to force the file to be downloaded without having to be rendered by the browser then we can use the Content-Disposition
header. More details can be seen on this page https://developer.mozilla.org/en-US/docs/Web/Headers/Content-Disposition.
17 How to Upload File in Golang
Upload Files
Apart from receiving data input in the form of forms and query params, we usually also need data input in the form of files from our users. Golang actually already has this feature to handle file upload management. This makes it easier for us if we create a website that can accept file input.
08 How to Understanding File Server in Golang
Introduction to File Server
Golang has a feature called FileServer. With this we can create a Handler in Golang Web that we have used as a static file server and this FileServer does not need to be manually loaded again. So we can add it to http.Server
or http.ServeMux
.