Home / Function/ FileAttachment() — gin Function Reference

FileAttachment() — gin Function Reference

Architecture documentation for the FileAttachment() function in context.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  7d22664f_979d_d3fb_6d41_502be0428615["FileAttachment()"]
  8bbfb136_f6d5_6a2a_941a_8150c630a768["Header()"]
  7d22664f_979d_d3fb_6d41_502be0428615 -->|calls| 8bbfb136_f6d5_6a2a_941a_8150c630a768
  6e9cb785_6d47_c8a3_8dee_973da7d71486["Set()"]
  7d22664f_979d_d3fb_6d41_502be0428615 -->|calls| 6e9cb785_6d47_c8a3_8dee_973da7d71486
  947a8f25_d556_9d3b_6b66_1f353351d788["escapeQuotes()"]
  7d22664f_979d_d3fb_6d41_502be0428615 -->|calls| 947a8f25_d556_9d3b_6b66_1f353351d788
  style 7d22664f_979d_d3fb_6d41_502be0428615 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

context.go lines 1302–1309

func (c *Context) FileAttachment(filepath, filename string) {
	if isASCII(filename) {
		c.Writer.Header().Set("Content-Disposition", `attachment; filename="`+escapeQuotes(filename)+`"`)
	} else {
		c.Writer.Header().Set("Content-Disposition", `attachment; filename*=UTF-8''`+url.QueryEscape(filename))
	}
	http.ServeFile(c.Writer, c.Request, filepath)
}

Domain

Subdomains

Frequently Asked Questions

What does FileAttachment() do?
FileAttachment() is a function in the gin codebase.
What does FileAttachment() call?
FileAttachment() calls 3 function(s): Header, Set, escapeQuotes.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free