func fileExceed(file multipart.File, limitSize int64) bool { var isExceed bool read_buf := make([]byte, 1024) var pos int64 = 0 for { n, err := file.ReadAt(read_buf, pos) if err != nil && err != io.EOF { panic(err) } if n == 0 { break } pos = pos + (int64)(n) if pos > limitSize { isExceed = true break } } return isExceed }