The docs say that
If the file is stored on disk, the file under the concrete type will be * Os.File.
In this case, everything is clear. Fine. But what happens if not, if the file is stored in memory?
My actual problem is that I am trying to get the size of the various files stored in memory that I received using the html form, but I cannot use os.Stat to execute fileInfo.Size () because I do not want to specify the location file, just its name.
fhs := req.MultipartForm.File["files"]
for _, fileHeader := range fhs {
file, _ := fileHeader.Open()
log.Println(len(file))
fileInfo, err := os.Stat(fileHeader.Filename)
}
source
share