You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

741 lines
22 KiB

8 years ago
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <meta name="theme-color" content="#375EAB">
  7. <title>multipart - The Go Programming Language</title>
  8. <link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css">
  9. <link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css">
  10. <script type="text/javascript">window.initFuncs = [];</script>
  11. </head>
  12. <body>
  13. <div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;">
  14. ...
  15. </div><!-- #lowframe -->
  16. <div id="topbar" class="wide"><div class="container">
  17. <div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div>
  18. <div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div>
  19. <a href="index.html#" id="menu-button"><span id="menu-button-arrow">&#9661;</span></a>
  20. <form method="GET" action="http://localhost:6060/search">
  21. <div id="menu">
  22. <a href="http://localhost:6060/doc/">Documents</a>
  23. <a href="http://localhost:6060/pkg/">Packages</a>
  24. <a href="http://localhost:6060/project/">The Project</a>
  25. <a href="http://localhost:6060/help/">Help</a>
  26. <a href="http://localhost:6060/blog/">Blog</a>
  27. <input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search">
  28. </div>
  29. </form>
  30. </div></div>
  31. <div id="page" class="wide">
  32. <div class="container">
  33. <h1>Package multipart</h1>
  34. <div id="nav"></div>
  35. <!--
  36. Copyright 2009 The Go Authors. All rights reserved.
  37. Use of this source code is governed by a BSD-style
  38. license that can be found in the LICENSE file.
  39. -->
  40. <!--
  41. Note: Static (i.e., not template-generated) href and id
  42. attributes start with "pkg-" to make it impossible for
  43. them to conflict with generated attributes (some of which
  44. correspond to Go identifiers).
  45. -->
  46. <script type='text/javascript'>
  47. document.ANALYSIS_DATA = null;
  48. document.CALLGRAPH = null;
  49. </script>
  50. <div id="short-nav">
  51. <dl>
  52. <dd><code>import "mime/multipart"</code></dd>
  53. </dl>
  54. <dl>
  55. <dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd>
  56. <dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd>
  57. <dd><a href="index.html#pkg-examples" class="examplesLink">Examples</a></dd>
  58. </dl>
  59. </div>
  60. <!-- The package's Name is printed as title by the top-level template -->
  61. <div id="pkg-overview" class="toggleVisible">
  62. <div class="collapsed">
  63. <h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
  64. </div>
  65. <div class="expanded">
  66. <h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2>
  67. <p>
  68. Package multipart implements MIME multipart parsing, as defined in RFC
  69. 2046.
  70. </p>
  71. <p>
  72. The implementation is sufficient for HTTP (RFC 2388) and the multipart
  73. bodies generated by popular browsers.
  74. </p>
  75. </div>
  76. </div>
  77. <div id="pkg-index" class="toggleVisible">
  78. <div class="collapsed">
  79. <h2 class="toggleButton" title="Click to show Index section">Index ▹</h2>
  80. </div>
  81. <div class="expanded">
  82. <h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>
  83. <!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
  84. <div id="manual-nav">
  85. <dl>
  86. <dd><a href="index.html#File">type File</a></dd>
  87. <dd><a href="index.html#FileHeader">type FileHeader</a></dd>
  88. <dd>&nbsp; &nbsp; <a href="index.html#FileHeader.Open">func (fh *FileHeader) Open() (File, error)</a></dd>
  89. <dd><a href="index.html#Form">type Form</a></dd>
  90. <dd>&nbsp; &nbsp; <a href="index.html#Form.RemoveAll">func (f *Form) RemoveAll() error</a></dd>
  91. <dd><a href="index.html#Part">type Part</a></dd>
  92. <dd>&nbsp; &nbsp; <a href="index.html#Part.Close">func (p *Part) Close() error</a></dd>
  93. <dd>&nbsp; &nbsp; <a href="index.html#Part.FileName">func (p *Part) FileName() string</a></dd>
  94. <dd>&nbsp; &nbsp; <a href="index.html#Part.FormName">func (p *Part) FormName() string</a></dd>
  95. <dd>&nbsp; &nbsp; <a href="index.html#Part.Read">func (p *Part) Read(d []byte) (n int, err error)</a></dd>
  96. <dd><a href="index.html#Reader">type Reader</a></dd>
  97. <dd>&nbsp; &nbsp; <a href="index.html#NewReader">func NewReader(r io.Reader, boundary string) *Reader</a></dd>
  98. <dd>&nbsp; &nbsp; <a href="index.html#Reader.NextPart">func (r *Reader) NextPart() (*Part, error)</a></dd>
  99. <dd>&nbsp; &nbsp; <a href="index.html#Reader.ReadForm">func (r *Reader) ReadForm(maxMemory int64) (f *Form, err error)</a></dd>
  100. <dd><a href="index.html#Writer">type Writer</a></dd>
  101. <dd>&nbsp; &nbsp; <a href="index.html#NewWriter">func NewWriter(w io.Writer) *Writer</a></dd>
  102. <dd>&nbsp; &nbsp; <a href="index.html#Writer.Boundary">func (w *Writer) Boundary() string</a></dd>
  103. <dd>&nbsp; &nbsp; <a href="index.html#Writer.Close">func (w *Writer) Close() error</a></dd>
  104. <dd>&nbsp; &nbsp; <a href="index.html#Writer.CreateFormField">func (w *Writer) CreateFormField(fieldname string) (io.Writer, error)</a></dd>
  105. <dd>&nbsp; &nbsp; <a href="index.html#Writer.CreateFormFile">func (w *Writer) CreateFormFile(fieldname, filename string) (io.Writer, error)</a></dd>
  106. <dd>&nbsp; &nbsp; <a href="index.html#Writer.CreatePart">func (w *Writer) CreatePart(header textproto.MIMEHeader) (io.Writer, error)</a></dd>
  107. <dd>&nbsp; &nbsp; <a href="index.html#Writer.FormDataContentType">func (w *Writer) FormDataContentType() string</a></dd>
  108. <dd>&nbsp; &nbsp; <a href="index.html#Writer.SetBoundary">func (w *Writer) SetBoundary(boundary string) error</a></dd>
  109. <dd>&nbsp; &nbsp; <a href="index.html#Writer.WriteField">func (w *Writer) WriteField(fieldname, value string) error</a></dd>
  110. </dl>
  111. </div><!-- #manual-nav -->
  112. <div id="pkg-examples">
  113. <h4>Examples</h4>
  114. <dl>
  115. <dd><a class="exampleLink" href="index.html#example_NewReader">NewReader</a></dd>
  116. </dl>
  117. </div>
  118. <h4>Package files</h4>
  119. <p>
  120. <span style="font-size:90%">
  121. <a href="http://localhost:6060/src/mime/multipart/formdata.go">formdata.go</a>
  122. <a href="http://localhost:6060/src/mime/multipart/multipart.go">multipart.go</a>
  123. <a href="http://localhost:6060/src/mime/multipart/writer.go">writer.go</a>
  124. </span>
  125. </p>
  126. </div><!-- .expanded -->
  127. </div><!-- #pkg-index -->
  128. <div id="pkg-callgraph" class="toggle" style="display: none">
  129. <div class="collapsed">
  130. <h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2>
  131. </div> <!-- .expanded -->
  132. <div class="expanded">
  133. <h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2>
  134. <p>
  135. In the call graph viewer below, each node
  136. is a function belonging to this package
  137. and its children are the functions it
  138. calls&mdash;perhaps dynamically.
  139. </p>
  140. <p>
  141. The root nodes are the entry points of the
  142. package: functions that may be called from
  143. outside the package.
  144. There may be non-exported or anonymous
  145. functions among them if they are called
  146. dynamically from another package.
  147. </p>
  148. <p>
  149. Click a node to visit that function's source code.
  150. From there you can visit its callers by
  151. clicking its declaring <code>func</code>
  152. token.
  153. </p>
  154. <p>
  155. Functions may be omitted if they were
  156. determined to be unreachable in the
  157. particular programs or tests that were
  158. analyzed.
  159. </p>
  160. <!-- Zero means show all package entry points. -->
  161. <ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul>
  162. </div>
  163. </div> <!-- #pkg-callgraph -->
  164. <h2 id="File">type <a href="http://localhost:6060/src/mime/multipart/formdata.go?s=3363:3432#L132">File</a></h2>
  165. <pre>type File interface {
  166. <a href="../../io/index.html">io</a>.<a href="../../io/index.html#Reader">Reader</a>
  167. <a href="../../io/index.html">io</a>.<a href="../../io/index.html#ReaderAt">ReaderAt</a>
  168. <a href="../../io/index.html">io</a>.<a href="../../io/index.html#Seeker">Seeker</a>
  169. <a href="../../io/index.html">io</a>.<a href="../../io/index.html#Closer">Closer</a>
  170. }</pre>
  171. <p>
  172. File is an interface to access the file part of a multipart message.
  173. Its contents may be either stored in memory or on disk.
  174. If stored on disk, the File&#39;s underlying concrete type will be an *os.File.
  175. </p>
  176. <h2 id="FileHeader">type <a href="http://localhost:6060/src/mime/multipart/formdata.go?s=2773:2880#L112">FileHeader</a></h2>
  177. <pre>type FileHeader struct {
  178. Filename <a href="../../builtin/index.html#string">string</a>
  179. Header <a href="../../net/textproto/index.html">textproto</a>.<a href="../../net/textproto/index.html#MIMEHeader">MIMEHeader</a>
  180. <span class="comment">// contains filtered or unexported fields</span>
  181. }</pre>
  182. <p>
  183. A FileHeader describes a file part of a multipart request.
  184. </p>
  185. <h3 id="FileHeader.Open">func (*FileHeader) <a href="http://localhost:6060/src/mime/multipart/formdata.go?s=2942:2984#L121">Open</a></h3>
  186. <pre>func (fh *<a href="index.html#FileHeader">FileHeader</a>) Open() (<a href="index.html#File">File</a>, <a href="../../builtin/index.html#error">error</a>)</pre>
  187. <p>
  188. Open opens and returns the FileHeader&#39;s associated File.
  189. </p>
  190. <h2 id="Form">type <a href="http://localhost:6060/src/mime/multipart/formdata.go?s=2324:2403#L90">Form</a></h2>
  191. <pre>type Form struct {
  192. Value map[<a href="../../builtin/index.html#string">string</a>][]<a href="../../builtin/index.html#string">string</a>
  193. File map[<a href="../../builtin/index.html#string">string</a>][]*<a href="index.html#FileHeader">FileHeader</a>
  194. }</pre>
  195. <p>
  196. Form is a parsed multipart form.
  197. Its File parts are stored either in memory or on disk,
  198. and are accessible via the *FileHeader&#39;s Open method.
  199. Its Value parts are stored as strings.
  200. Both are keyed by field name.
  201. </p>
  202. <h3 id="Form.RemoveAll">func (*Form) <a href="http://localhost:6060/src/mime/multipart/formdata.go?s=2470:2502#L96">RemoveAll</a></h3>
  203. <pre>func (f *<a href="index.html#Form">Form</a>) RemoveAll() <a href="../../builtin/index.html#error">error</a></pre>
  204. <p>
  205. RemoveAll removes any temporary files associated with a Form.
  206. </p>
  207. <h2 id="Part">type <a href="http://localhost:6060/src/mime/multipart/multipart.go?s=814:1536#L24">Part</a></h2>
  208. <pre>type Part struct {
  209. <span class="comment">// The headers of the body, if any, with the keys canonicalized</span>
  210. <span class="comment">// in the same fashion that the Go http.Request headers are.</span>
  211. <span class="comment">// For example, &#34;foo-bar&#34; changes case to &#34;Foo-Bar&#34;</span>
  212. <span class="comment">//</span>
  213. <span class="comment">// As a special case, if the &#34;Content-Transfer-Encoding&#34; header</span>
  214. <span class="comment">// has a value of &#34;quoted-printable&#34;, that header is instead</span>
  215. <span class="comment">// hidden from this map and the body is transparently decoded</span>
  216. <span class="comment">// during Read calls.</span>
  217. Header <a href="../../net/textproto/index.html">textproto</a>.<a href="../../net/textproto/index.html#MIMEHeader">MIMEHeader</a>
  218. <span class="comment">// contains filtered or unexported fields</span>
  219. }</pre>
  220. <p>
  221. A Part represents a single part in a multipart body.
  222. </p>
  223. <h3 id="Part.Close">func (*Part) <a href="http://localhost:6060/src/mime/multipart/multipart.go?s=5847:5875#L197">Close</a></h3>
  224. <pre>func (p *<a href="index.html#Part">Part</a>) Close() <a href="../../builtin/index.html#error">error</a></pre>
  225. <h3 id="Part.FileName">func (*Part) <a href="http://localhost:6060/src/mime/multipart/multipart.go?s=2053:2085#L64">FileName</a></h3>
  226. <pre>func (p *<a href="index.html#Part">Part</a>) FileName() <a href="../../builtin/index.html#string">string</a></pre>
  227. <p>
  228. FileName returns the filename parameter of the Part&#39;s
  229. Content-Disposition header.
  230. </p>
  231. <h3 id="Part.FormName">func (*Part) <a href="http://localhost:6060/src/mime/multipart/multipart.go?s=1672:1704#L50">FormName</a></h3>
  232. <pre>func (p *<a href="index.html#Part">Part</a>) FormName() <a href="../../builtin/index.html#string">string</a></pre>
  233. <p>
  234. FormName returns the name parameter if p has a Content-Disposition
  235. of type &#34;form-data&#34;. Otherwise it returns the empty string.
  236. </p>
  237. <h3 id="Part.Read">func (*Part) <a href="http://localhost:6060/src/mime/multipart/multipart.go?s=3655:3703#L126">Read</a></h3>
  238. <pre>func (p *<a href="index.html#Part">Part</a>) Read(d []<a href="../../builtin/index.html#byte">byte</a>) (n <a href="../../builtin/index.html#int">int</a>, err <a href="../../builtin/index.html#error">error</a>)</pre>
  239. <p>
  240. Read reads the body of a part, after its headers and before the
  241. next part (if any) begins.
  242. </p>
  243. <h2 id="Reader">type <a href="http://localhost:6060/src/mime/multipart/multipart.go?s=6072:6369#L205">Reader</a></h2>
  244. <pre>type Reader struct {
  245. <span class="comment">// contains filtered or unexported fields</span>
  246. }</pre>
  247. <p>
  248. Reader is an iterator over parts in a MIME multipart body.
  249. Reader&#39;s underlying parser consumes its input as needed. Seeking
  250. isn&#39;t supported.
  251. </p>
  252. <h3 id="NewReader">func <a href="http://localhost:6060/src/mime/multipart/multipart.go?s=2677:2729#L86">NewReader</a></h3>
  253. <pre>func NewReader(r <a href="../../io/index.html">io</a>.<a href="../../io/index.html#Reader">Reader</a>, boundary <a href="../../builtin/index.html#string">string</a>) *<a href="index.html#Reader">Reader</a></pre>
  254. <p>
  255. NewReader creates a new multipart Reader reading from r using the
  256. given MIME boundary.
  257. </p>
  258. <p>
  259. The boundary is usually obtained from the &#34;boundary&#34; parameter of
  260. the message&#39;s &#34;Content-Type&#34; header. Use mime.ParseMediaType to
  261. parse such headers.
  262. </p>
  263. <div id="example_NewReader" class="toggle">
  264. <div class="collapsed">
  265. <p class="exampleHeading toggleButton"><span class="text">Example</span></p>
  266. </div>
  267. <div class="expanded">
  268. <p class="exampleHeading toggleButton"><span class="text">Example</span></p>
  269. <p>Code:</p>
  270. <pre class="code">msg := &amp;mail.Message{
  271. Header: map[string][]string{
  272. &#34;Content-Type&#34;: {&#34;multipart/mixed; boundary=foo&#34;},
  273. },
  274. Body: strings.NewReader(
  275. &#34;--foo\r\nFoo: one\r\n\r\nA section\r\n&#34; +
  276. &#34;--foo\r\nFoo: two\r\n\r\nAnd another\r\n&#34; +
  277. &#34;--foo--\r\n&#34;),
  278. }
  279. mediaType, params, err := mime.ParseMediaType(msg.Header.Get(&#34;Content-Type&#34;))
  280. if err != nil {
  281. log.Fatal(err)
  282. }
  283. if strings.HasPrefix(mediaType, &#34;multipart/&#34;) {
  284. mr := multipart.NewReader(msg.Body, params[&#34;boundary&#34;])
  285. for {
  286. p, err := mr.NextPart()
  287. if err == io.EOF {
  288. return
  289. }
  290. if err != nil {
  291. log.Fatal(err)
  292. }
  293. slurp, err := ioutil.ReadAll(p)
  294. if err != nil {
  295. log.Fatal(err)
  296. }
  297. fmt.Printf(&#34;Part %q: %q\n&#34;, p.Header.Get(&#34;Foo&#34;), slurp)
  298. }
  299. }
  300. <span class="comment"></pre>
  301. <p>Output:</p>
  302. <pre class="output">Part &#34;one&#34;: &#34;A section&#34;
  303. Part &#34;two&#34;: &#34;And another&#34;
  304. </pre>
  305. </div>
  306. </div>
  307. <h3 id="Reader.NextPart">func (*Reader) <a href="http://localhost:6060/src/mime/multipart/multipart.go?s=6498:6540#L219">NextPart</a></h3>
  308. <pre>func (r *<a href="index.html#Reader">Reader</a>) NextPart() (*<a href="index.html#Part">Part</a>, <a href="../../builtin/index.html#error">error</a>)</pre>
  309. <p>
  310. NextPart returns the next part in the multipart or an error.
  311. When there are no more parts, the error io.EOF is returned.
  312. </p>
  313. <h3 id="Reader.ReadForm">func (*Reader) <a href="http://localhost:6060/src/mime/multipart/formdata.go?s=592:655#L13">ReadForm</a></h3>
  314. <pre>func (r *<a href="index.html#Reader">Reader</a>) ReadForm(maxMemory <a href="../../builtin/index.html#int64">int64</a>) (f *<a href="index.html#Form">Form</a>, err <a href="../../builtin/index.html#error">error</a>)</pre>
  315. <p>
  316. ReadForm parses an entire multipart message whose parts have
  317. a Content-Disposition of &#34;form-data&#34;.
  318. It stores up to maxMemory bytes of the file parts in memory
  319. and the remainder on disk in temporary files.
  320. </p>
  321. <h2 id="Writer">type <a href="http://localhost:6060/src/mime/multipart/writer.go?s=308:383#L8">Writer</a></h2>
  322. <pre>type Writer struct {
  323. <span class="comment">// contains filtered or unexported fields</span>
  324. }</pre>
  325. <p>
  326. A Writer generates multipart messages.
  327. </p>
  328. <h3 id="NewWriter">func <a href="http://localhost:6060/src/mime/multipart/writer.go?s=470:505#L16">NewWriter</a></h3>
  329. <pre>func NewWriter(w <a href="../../io/index.html">io</a>.<a href="../../io/index.html#Writer">Writer</a>) *<a href="index.html#Writer">Writer</a></pre>
  330. <p>
  331. NewWriter returns a new multipart Writer with a random boundary,
  332. writing to w.
  333. </p>
  334. <h3 id="Writer.Boundary">func (*Writer) <a href="http://localhost:6060/src/mime/multipart/writer.go?s=619:653#L24">Boundary</a></h3>
  335. <pre>func (w *<a href="index.html#Writer">Writer</a>) Boundary() <a href="../../builtin/index.html#string">string</a></pre>
  336. <p>
  337. Boundary returns the Writer&#39;s boundary.
  338. </p>
  339. <h3 id="Writer.Close">func (*Writer) <a href="http://localhost:6060/src/mime/multipart/writer.go?s=4092:4122#L144">Close</a></h3>
  340. <pre>func (w *<a href="index.html#Writer">Writer</a>) Close() <a href="../../builtin/index.html#error">error</a></pre>
  341. <p>
  342. Close finishes the multipart message and writes the trailing
  343. boundary end line to the output.
  344. </p>
  345. <h3 id="Writer.CreateFormField">func (*Writer) <a href="http://localhost:6060/src/mime/multipart/writer.go?s=3515:3584#L125">CreateFormField</a></h3>
  346. <pre>func (w *<a href="index.html#Writer">Writer</a>) CreateFormField(fieldname <a href="../../builtin/index.html#string">string</a>) (<a href="../../io/index.html">io</a>.<a href="../../io/index.html#Writer">Writer</a>, <a href="../../builtin/index.html#error">error</a>)</pre>
  347. <p>
  348. CreateFormField calls CreatePart with a header using the
  349. given field name.
  350. </p>
  351. <h3 id="Writer.CreateFormFile">func (*Writer) <a href="http://localhost:6060/src/mime/multipart/writer.go?s=3106:3184#L114">CreateFormFile</a></h3>
  352. <pre>func (w *<a href="index.html#Writer">Writer</a>) CreateFormFile(fieldname, filename <a href="../../builtin/index.html#string">string</a>) (<a href="../../io/index.html">io</a>.<a href="../../io/index.html#Writer">Writer</a>, <a href="../../builtin/index.html#error">error</a>)</pre>
  353. <p>
  354. CreateFormFile is a convenience wrapper around CreatePart. It creates
  355. a new form-data header with the provided field name and file name.
  356. </p>
  357. <h3 id="Writer.CreatePart">func (*Writer) <a href="http://localhost:6060/src/mime/multipart/writer.go?s=2132:2207#L75">CreatePart</a></h3>
  358. <pre>func (w *<a href="index.html#Writer">Writer</a>) CreatePart(header <a href="../../net/textproto/index.html">textproto</a>.<a href="../../net/textproto/index.html#MIMEHeader">MIMEHeader</a>) (<a href="../../io/index.html">io</a>.<a href="../../io/index.html#Writer">Writer</a>, <a href="../../builtin/index.html#error">error</a>)</pre>
  359. <p>
  360. CreatePart creates a new multipart section with the provided
  361. header. The body of the part should be written to the returned
  362. Writer. After calling CreatePart, any previous part may no longer
  363. be written to.
  364. </p>
  365. <h3 id="Writer.FormDataContentType">func (*Writer) <a href="http://localhost:6060/src/mime/multipart/writer.go?s=1647:1692#L58">FormDataContentType</a></h3>
  366. <pre>func (w *<a href="index.html#Writer">Writer</a>) FormDataContentType() <a href="../../builtin/index.html#string">string</a></pre>
  367. <p>
  368. FormDataContentType returns the Content-Type for an HTTP
  369. multipart/form-data with this Writer&#39;s Boundary.
  370. </p>
  371. <h3 id="Writer.SetBoundary">func (*Writer) <a href="http://localhost:6060/src/mime/multipart/writer.go?s=950:1001#L34">SetBoundary</a></h3>
  372. <pre>func (w *<a href="index.html#Writer">Writer</a>) SetBoundary(boundary <a href="../../builtin/index.html#string">string</a>) <a href="../../builtin/index.html#error">error</a></pre>
  373. <p>
  374. SetBoundary overrides the Writer&#39;s default randomly-generated
  375. boundary separator with an explicit value.
  376. </p>
  377. <p>
  378. SetBoundary must be called before any parts are created, may only
  379. contain certain ASCII characters, and must be non-empty and
  380. at most 69 bytes long.
  381. </p>
  382. <h3 id="Writer.WriteField">func (*Writer) <a href="http://localhost:6060/src/mime/multipart/writer.go?s=3810:3868#L133">WriteField</a></h3>
  383. <pre>func (w *<a href="index.html#Writer">Writer</a>) WriteField(fieldname, value <a href="../../builtin/index.html#string">string</a>) <a href="../../builtin/index.html#error">error</a></pre>
  384. <p>
  385. WriteField calls CreateFormField and then writes the given value.
  386. </p>
  387. <div id="footer">
  388. Build version go1.6.<br>
  389. Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>,
  390. the content of this page is licensed under the
  391. Creative Commons Attribution 3.0 License,
  392. and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br>
  393. <a href="http://localhost:6060/doc/tos.html">Terms of Service</a> |
  394. <a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a>
  395. </div>
  396. </div><!-- .container -->
  397. </div><!-- #page -->
  398. <!-- TODO(adonovan): load these from <head> using "defer" attribute? -->
  399. <script type="text/javascript" src="../../../lib/godoc/jquery.js"></script>
  400. <script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script>
  401. <script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script>
  402. <script type="text/javascript" src="../../../lib/godoc/godocs.js"></script>
  403. </body>
  404. </html>