func (p *Part) setupContentHeaders(mediaParams map[string]string) {
	// Determine content disposition, filename, character set.
	disposition, dparams, _, err := parseMediaType(p.Header.Get(hnContentDisposition))
	if err == nil {
		// Disposition is optional
		p.Disposition = disposition
		p.FileName = decodeHeader(dparams[hpFilename])
	}
	if p.FileName == "" && mediaParams[hpName] != "" {
		p.FileName = decodeHeader(mediaParams[hpName])
	}
	if p.FileName == "" && mediaParams[hpFile] != "" {
		p.FileName = decodeHeader(mediaParams[hpFile])
	}
	if p.Charset == "" {
		p.Charset = mediaParams[hpCharset]
	}
	if p.FileModDate.IsZero() {
		p.FileModDate, _ = time.Parse(time.RFC822, mediaParams[hpModDate])
	}
}
func (p *Part) setupContentHeaders(mediaParams map[string]string) {
	
	disposition, dparams, _, err := parseMediaType(p.Header.Get(hnContentDisposition))
	if err == nil {
		
		p.Disposition = disposition
		p.FileName = decodeHeader(dparams[hpFilename])
	}
	if p.FileName == "" && mediaParams[hpName] != "" {
		p.FileName = decodeHeader(mediaParams[hpName])
	}
	if p.FileName == "" && mediaParams[hpFile] != "" {
		p.FileName = decodeHeader(mediaParams[hpFile])
	}
	if p.Charset == "" {
		p.Charset = mediaParams[hpCharset]
	}
	if p.FileModDate.IsZero() {
		p.FileModDate, _ = time.Parse(time.RFC822, mediaParams[hpModDate])
	}
}
func ( p * Part ) setupContentHeaders ( mediaParams map [ string ] string ) { // Determine content disposition, filename, character set. disposition , dparams , _ , err := parseMediaType ( p . Header . Get ( hnContentDisposition ) ) if err == nil { // Disposition is optional p . Disposition = disposition p . FileName = decodeHeader ( dparams [ hpFilename ] ) } if p . FileName == " " && mediaParams [ hpName ] != " " { p . FileName = decodeHeader ( mediaParams [ hpName ] ) } if p . FileName == " " && mediaParams [ hpFile ] != " " { p . FileName = decodeHeader ( mediaParams [ hpFile ] ) } if p . Charset == " " { p . Charset = mediaParams [ hpCharset ] } if p . FileModDate . IsZero ( ) { p . FileModDate , _ = time . Parse ( time . RFC822 , mediaParams [ hpModDate ] ) } }
// setupContentHeaders uses Content-Type media params and Content-Disposition headers to populate
// the disposition, filename, and charset fields.
setupContentHeaders uses Content - Type media params and Content - Disposition headers to populate the disposition filename and charset fields .