Golang mime/multipart.Part.Close(), FileName(), FormName() and Read() functions example
package mime/multipart
Golang mime/multipart.Part.Close(), FileName(), FormName() and Read() functions usage example
var line []byte
mr := multipart.NewReader(conn, MESSAGE_BOUNDARY)
for {
part, err := mr.NextPart()
if err == io.EOF {
return
}
if err != nil {
log.Fatal(err)
}
fmt.Printf("Part filename : %s\n", part.FileName())
fmt.Printf("Part form name : %s\n", part.FormName())
part.Read(line) // read into line buffer
}
part.Close()
References :
http://golang.org/pkg/mime/multipart/#Part.Close
http://golang.org/pkg/mime/multipart/#Part.FileName
Advertisement
Something interesting
Tutorials
+15.2k Golang : Accurate and reliable decimal calculations
+17k Golang : Capture stdout of a child process and act according to the result
+20.1k Golang : Compare floating-point numbers
+5.4k Golang : Display advertisement images or strings on random order
+16.3k Golang : Find out mime type from bytes in buffer
+14.3k Golang : Parsing or breaking down URL
+8.1k Android Studio : Rating bar example
+26.3k Golang : Get executable name behind process ID example
+18.5k Golang : Set, Get and List environment variables
+24.5k Golang : How to print rune, unicode, utf-8 and non-ASCII CJK(Chinese/Japanese/Korean) characters?