mirror of https://github.com/matrix-org/go-neb.git
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
741 lines
22 KiB
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="theme-color" content="#375EAB">
|
|
|
|
<title>multipart - The Go Programming Language</title>
|
|
|
|
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css">
|
|
|
|
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css">
|
|
<script type="text/javascript">window.initFuncs = [];</script>
|
|
</head>
|
|
<body>
|
|
|
|
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;">
|
|
...
|
|
</div><!-- #lowframe -->
|
|
|
|
<div id="topbar" class="wide"><div class="container">
|
|
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div>
|
|
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div>
|
|
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a>
|
|
<form method="GET" action="http://localhost:6060/search">
|
|
<div id="menu">
|
|
<a href="http://localhost:6060/doc/">Documents</a>
|
|
<a href="http://localhost:6060/pkg/">Packages</a>
|
|
<a href="http://localhost:6060/project/">The Project</a>
|
|
<a href="http://localhost:6060/help/">Help</a>
|
|
<a href="http://localhost:6060/blog/">Blog</a>
|
|
|
|
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search">
|
|
</div>
|
|
</form>
|
|
|
|
</div></div>
|
|
|
|
|
|
|
|
<div id="page" class="wide">
|
|
<div class="container">
|
|
|
|
|
|
<h1>Package multipart</h1>
|
|
|
|
|
|
|
|
|
|
<div id="nav"></div>
|
|
|
|
|
|
<!--
|
|
Copyright 2009 The Go Authors. All rights reserved.
|
|
Use of this source code is governed by a BSD-style
|
|
license that can be found in the LICENSE file.
|
|
-->
|
|
<!--
|
|
Note: Static (i.e., not template-generated) href and id
|
|
attributes start with "pkg-" to make it impossible for
|
|
them to conflict with generated attributes (some of which
|
|
correspond to Go identifiers).
|
|
-->
|
|
|
|
<script type='text/javascript'>
|
|
document.ANALYSIS_DATA = null;
|
|
document.CALLGRAPH = null;
|
|
</script>
|
|
|
|
|
|
|
|
<div id="short-nav">
|
|
<dl>
|
|
<dd><code>import "mime/multipart"</code></dd>
|
|
</dl>
|
|
<dl>
|
|
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd>
|
|
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd>
|
|
|
|
<dd><a href="index.html#pkg-examples" class="examplesLink">Examples</a></dd>
|
|
|
|
|
|
</dl>
|
|
</div>
|
|
<!-- The package's Name is printed as title by the top-level template -->
|
|
<div id="pkg-overview" class="toggleVisible">
|
|
<div class="collapsed">
|
|
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
|
|
</div>
|
|
<div class="expanded">
|
|
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2>
|
|
<p>
|
|
Package multipart implements MIME multipart parsing, as defined in RFC
|
|
2046.
|
|
</p>
|
|
<p>
|
|
The implementation is sufficient for HTTP (RFC 2388) and the multipart
|
|
bodies generated by popular browsers.
|
|
</p>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div id="pkg-index" class="toggleVisible">
|
|
<div class="collapsed">
|
|
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2>
|
|
</div>
|
|
<div class="expanded">
|
|
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>
|
|
|
|
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
|
|
<div id="manual-nav">
|
|
<dl>
|
|
|
|
|
|
|
|
|
|
|
|
<dd><a href="index.html#File">type File</a></dd>
|
|
|
|
|
|
|
|
|
|
<dd><a href="index.html#FileHeader">type FileHeader</a></dd>
|
|
|
|
|
|
|
|
<dd> <a href="index.html#FileHeader.Open">func (fh *FileHeader) Open() (File, error)</a></dd>
|
|
|
|
|
|
|
|
<dd><a href="index.html#Form">type Form</a></dd>
|
|
|
|
|
|
|
|
<dd> <a href="index.html#Form.RemoveAll">func (f *Form) RemoveAll() error</a></dd>
|
|
|
|
|
|
|
|
<dd><a href="index.html#Part">type Part</a></dd>
|
|
|
|
|
|
|
|
<dd> <a href="index.html#Part.Close">func (p *Part) Close() error</a></dd>
|
|
|
|
|
|
<dd> <a href="index.html#Part.FileName">func (p *Part) FileName() string</a></dd>
|
|
|
|
|
|
<dd> <a href="index.html#Part.FormName">func (p *Part) FormName() string</a></dd>
|
|
|
|
|
|
<dd> <a href="index.html#Part.Read">func (p *Part) Read(d []byte) (n int, err error)</a></dd>
|
|
|
|
|
|
|
|
<dd><a href="index.html#Reader">type Reader</a></dd>
|
|
|
|
|
|
<dd> <a href="index.html#NewReader">func NewReader(r io.Reader, boundary string) *Reader</a></dd>
|
|
|
|
|
|
|
|
<dd> <a href="index.html#Reader.NextPart">func (r *Reader) NextPart() (*Part, error)</a></dd>
|
|
|
|
|
|
<dd> <a href="index.html#Reader.ReadForm">func (r *Reader) ReadForm(maxMemory int64) (f *Form, err error)</a></dd>
|
|
|
|
|
|
|
|
<dd><a href="index.html#Writer">type Writer</a></dd>
|
|
|
|
|
|
<dd> <a href="index.html#NewWriter">func NewWriter(w io.Writer) *Writer</a></dd>
|
|
|
|
|
|
|
|
<dd> <a href="index.html#Writer.Boundary">func (w *Writer) Boundary() string</a></dd>
|
|
|
|
|
|
<dd> <a href="index.html#Writer.Close">func (w *Writer) Close() error</a></dd>
|
|
|
|
|
|
<dd> <a href="index.html#Writer.CreateFormField">func (w *Writer) CreateFormField(fieldname string) (io.Writer, error)</a></dd>
|
|
|
|
|
|
<dd> <a href="index.html#Writer.CreateFormFile">func (w *Writer) CreateFormFile(fieldname, filename string) (io.Writer, error)</a></dd>
|
|
|
|
|
|
<dd> <a href="index.html#Writer.CreatePart">func (w *Writer) CreatePart(header textproto.MIMEHeader) (io.Writer, error)</a></dd>
|
|
|
|
|
|
<dd> <a href="index.html#Writer.FormDataContentType">func (w *Writer) FormDataContentType() string</a></dd>
|
|
|
|
|
|
<dd> <a href="index.html#Writer.SetBoundary">func (w *Writer) SetBoundary(boundary string) error</a></dd>
|
|
|
|
|
|
<dd> <a href="index.html#Writer.WriteField">func (w *Writer) WriteField(fieldname, value string) error</a></dd>
|
|
|
|
|
|
|
|
</dl>
|
|
</div><!-- #manual-nav -->
|
|
|
|
|
|
<div id="pkg-examples">
|
|
<h4>Examples</h4>
|
|
<dl>
|
|
|
|
<dd><a class="exampleLink" href="index.html#example_NewReader">NewReader</a></dd>
|
|
|
|
</dl>
|
|
</div>
|
|
|
|
|
|
|
|
<h4>Package files</h4>
|
|
<p>
|
|
<span style="font-size:90%">
|
|
|
|
<a href="http://localhost:6060/src/mime/multipart/formdata.go">formdata.go</a>
|
|
|
|
<a href="http://localhost:6060/src/mime/multipart/multipart.go">multipart.go</a>
|
|
|
|
<a href="http://localhost:6060/src/mime/multipart/writer.go">writer.go</a>
|
|
|
|
</span>
|
|
</p>
|
|
|
|
</div><!-- .expanded -->
|
|
</div><!-- #pkg-index -->
|
|
|
|
<div id="pkg-callgraph" class="toggle" style="display: none">
|
|
<div class="collapsed">
|
|
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2>
|
|
</div> <!-- .expanded -->
|
|
<div class="expanded">
|
|
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2>
|
|
<p>
|
|
In the call graph viewer below, each node
|
|
is a function belonging to this package
|
|
and its children are the functions it
|
|
calls—perhaps dynamically.
|
|
</p>
|
|
<p>
|
|
The root nodes are the entry points of the
|
|
package: functions that may be called from
|
|
outside the package.
|
|
There may be non-exported or anonymous
|
|
functions among them if they are called
|
|
dynamically from another package.
|
|
</p>
|
|
<p>
|
|
Click a node to visit that function's source code.
|
|
From there you can visit its callers by
|
|
clicking its declaring <code>func</code>
|
|
token.
|
|
</p>
|
|
<p>
|
|
Functions may be omitted if they were
|
|
determined to be unreachable in the
|
|
particular programs or tests that were
|
|
analyzed.
|
|
</p>
|
|
<!-- Zero means show all package entry points. -->
|
|
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul>
|
|
</div>
|
|
</div> <!-- #pkg-callgraph -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h2 id="File">type <a href="http://localhost:6060/src/mime/multipart/formdata.go?s=3363:3432#L132">File</a></h2>
|
|
<pre>type File interface {
|
|
<a href="../../io/index.html">io</a>.<a href="../../io/index.html#Reader">Reader</a>
|
|
<a href="../../io/index.html">io</a>.<a href="../../io/index.html#ReaderAt">ReaderAt</a>
|
|
<a href="../../io/index.html">io</a>.<a href="../../io/index.html#Seeker">Seeker</a>
|
|
<a href="../../io/index.html">io</a>.<a href="../../io/index.html#Closer">Closer</a>
|
|
}</pre>
|
|
<p>
|
|
File is an interface to access the file part of a multipart message.
|
|
Its contents may be either stored in memory or on disk.
|
|
If stored on disk, the File's underlying concrete type will be an *os.File.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h2 id="FileHeader">type <a href="http://localhost:6060/src/mime/multipart/formdata.go?s=2773:2880#L112">FileHeader</a></h2>
|
|
<pre>type FileHeader struct {
|
|
Filename <a href="../../builtin/index.html#string">string</a>
|
|
Header <a href="../../net/textproto/index.html">textproto</a>.<a href="../../net/textproto/index.html#MIMEHeader">MIMEHeader</a>
|
|
<span class="comment">// contains filtered or unexported fields</span>
|
|
}</pre>
|
|
<p>
|
|
A FileHeader describes a file part of a multipart request.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 id="FileHeader.Open">func (*FileHeader) <a href="http://localhost:6060/src/mime/multipart/formdata.go?s=2942:2984#L121">Open</a></h3>
|
|
<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>
|
|
<p>
|
|
Open opens and returns the FileHeader's associated File.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h2 id="Form">type <a href="http://localhost:6060/src/mime/multipart/formdata.go?s=2324:2403#L90">Form</a></h2>
|
|
<pre>type Form struct {
|
|
Value map[<a href="../../builtin/index.html#string">string</a>][]<a href="../../builtin/index.html#string">string</a>
|
|
File map[<a href="../../builtin/index.html#string">string</a>][]*<a href="index.html#FileHeader">FileHeader</a>
|
|
}</pre>
|
|
<p>
|
|
Form is a parsed multipart form.
|
|
Its File parts are stored either in memory or on disk,
|
|
and are accessible via the *FileHeader's Open method.
|
|
Its Value parts are stored as strings.
|
|
Both are keyed by field name.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 id="Form.RemoveAll">func (*Form) <a href="http://localhost:6060/src/mime/multipart/formdata.go?s=2470:2502#L96">RemoveAll</a></h3>
|
|
<pre>func (f *<a href="index.html#Form">Form</a>) RemoveAll() <a href="../../builtin/index.html#error">error</a></pre>
|
|
<p>
|
|
RemoveAll removes any temporary files associated with a Form.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h2 id="Part">type <a href="http://localhost:6060/src/mime/multipart/multipart.go?s=814:1536#L24">Part</a></h2>
|
|
<pre>type Part struct {
|
|
<span class="comment">// The headers of the body, if any, with the keys canonicalized</span>
|
|
<span class="comment">// in the same fashion that the Go http.Request headers are.</span>
|
|
<span class="comment">// For example, "foo-bar" changes case to "Foo-Bar"</span>
|
|
<span class="comment">//</span>
|
|
<span class="comment">// As a special case, if the "Content-Transfer-Encoding" header</span>
|
|
<span class="comment">// has a value of "quoted-printable", that header is instead</span>
|
|
<span class="comment">// hidden from this map and the body is transparently decoded</span>
|
|
<span class="comment">// during Read calls.</span>
|
|
Header <a href="../../net/textproto/index.html">textproto</a>.<a href="../../net/textproto/index.html#MIMEHeader">MIMEHeader</a>
|
|
<span class="comment">// contains filtered or unexported fields</span>
|
|
}</pre>
|
|
<p>
|
|
A Part represents a single part in a multipart body.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 id="Part.Close">func (*Part) <a href="http://localhost:6060/src/mime/multipart/multipart.go?s=5847:5875#L197">Close</a></h3>
|
|
<pre>func (p *<a href="index.html#Part">Part</a>) Close() <a href="../../builtin/index.html#error">error</a></pre>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 id="Part.FileName">func (*Part) <a href="http://localhost:6060/src/mime/multipart/multipart.go?s=2053:2085#L64">FileName</a></h3>
|
|
<pre>func (p *<a href="index.html#Part">Part</a>) FileName() <a href="../../builtin/index.html#string">string</a></pre>
|
|
<p>
|
|
FileName returns the filename parameter of the Part's
|
|
Content-Disposition header.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 id="Part.FormName">func (*Part) <a href="http://localhost:6060/src/mime/multipart/multipart.go?s=1672:1704#L50">FormName</a></h3>
|
|
<pre>func (p *<a href="index.html#Part">Part</a>) FormName() <a href="../../builtin/index.html#string">string</a></pre>
|
|
<p>
|
|
FormName returns the name parameter if p has a Content-Disposition
|
|
of type "form-data". Otherwise it returns the empty string.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 id="Part.Read">func (*Part) <a href="http://localhost:6060/src/mime/multipart/multipart.go?s=3655:3703#L126">Read</a></h3>
|
|
<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>
|
|
<p>
|
|
Read reads the body of a part, after its headers and before the
|
|
next part (if any) begins.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h2 id="Reader">type <a href="http://localhost:6060/src/mime/multipart/multipart.go?s=6072:6369#L205">Reader</a></h2>
|
|
<pre>type Reader struct {
|
|
<span class="comment">// contains filtered or unexported fields</span>
|
|
}</pre>
|
|
<p>
|
|
Reader is an iterator over parts in a MIME multipart body.
|
|
Reader's underlying parser consumes its input as needed. Seeking
|
|
isn't supported.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 id="NewReader">func <a href="http://localhost:6060/src/mime/multipart/multipart.go?s=2677:2729#L86">NewReader</a></h3>
|
|
<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>
|
|
<p>
|
|
NewReader creates a new multipart Reader reading from r using the
|
|
given MIME boundary.
|
|
</p>
|
|
<p>
|
|
The boundary is usually obtained from the "boundary" parameter of
|
|
the message's "Content-Type" header. Use mime.ParseMediaType to
|
|
parse such headers.
|
|
</p>
|
|
|
|
<div id="example_NewReader" class="toggle">
|
|
<div class="collapsed">
|
|
<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p>
|
|
</div>
|
|
<div class="expanded">
|
|
<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p>
|
|
|
|
|
|
|
|
<p>Code:</p>
|
|
<pre class="code">msg := &mail.Message{
|
|
Header: map[string][]string{
|
|
"Content-Type": {"multipart/mixed; boundary=foo"},
|
|
},
|
|
Body: strings.NewReader(
|
|
"--foo\r\nFoo: one\r\n\r\nA section\r\n" +
|
|
"--foo\r\nFoo: two\r\n\r\nAnd another\r\n" +
|
|
"--foo--\r\n"),
|
|
}
|
|
mediaType, params, err := mime.ParseMediaType(msg.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
if strings.HasPrefix(mediaType, "multipart/") {
|
|
mr := multipart.NewReader(msg.Body, params["boundary"])
|
|
for {
|
|
p, err := mr.NextPart()
|
|
if err == io.EOF {
|
|
return
|
|
}
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
slurp, err := ioutil.ReadAll(p)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
fmt.Printf("Part %q: %q\n", p.Header.Get("Foo"), slurp)
|
|
}
|
|
}
|
|
|
|
<span class="comment"></pre>
|
|
|
|
<p>Output:</p>
|
|
<pre class="output">Part "one": "A section"
|
|
Part "two": "And another"
|
|
</pre>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 id="Reader.NextPart">func (*Reader) <a href="http://localhost:6060/src/mime/multipart/multipart.go?s=6498:6540#L219">NextPart</a></h3>
|
|
<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>
|
|
<p>
|
|
NextPart returns the next part in the multipart or an error.
|
|
When there are no more parts, the error io.EOF is returned.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 id="Reader.ReadForm">func (*Reader) <a href="http://localhost:6060/src/mime/multipart/formdata.go?s=592:655#L13">ReadForm</a></h3>
|
|
<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>
|
|
<p>
|
|
ReadForm parses an entire multipart message whose parts have
|
|
a Content-Disposition of "form-data".
|
|
It stores up to maxMemory bytes of the file parts in memory
|
|
and the remainder on disk in temporary files.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h2 id="Writer">type <a href="http://localhost:6060/src/mime/multipart/writer.go?s=308:383#L8">Writer</a></h2>
|
|
<pre>type Writer struct {
|
|
<span class="comment">// contains filtered or unexported fields</span>
|
|
}</pre>
|
|
<p>
|
|
A Writer generates multipart messages.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 id="NewWriter">func <a href="http://localhost:6060/src/mime/multipart/writer.go?s=470:505#L16">NewWriter</a></h3>
|
|
<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>
|
|
<p>
|
|
NewWriter returns a new multipart Writer with a random boundary,
|
|
writing to w.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 id="Writer.Boundary">func (*Writer) <a href="http://localhost:6060/src/mime/multipart/writer.go?s=619:653#L24">Boundary</a></h3>
|
|
<pre>func (w *<a href="index.html#Writer">Writer</a>) Boundary() <a href="../../builtin/index.html#string">string</a></pre>
|
|
<p>
|
|
Boundary returns the Writer's boundary.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 id="Writer.Close">func (*Writer) <a href="http://localhost:6060/src/mime/multipart/writer.go?s=4092:4122#L144">Close</a></h3>
|
|
<pre>func (w *<a href="index.html#Writer">Writer</a>) Close() <a href="../../builtin/index.html#error">error</a></pre>
|
|
<p>
|
|
Close finishes the multipart message and writes the trailing
|
|
boundary end line to the output.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 id="Writer.CreateFormField">func (*Writer) <a href="http://localhost:6060/src/mime/multipart/writer.go?s=3515:3584#L125">CreateFormField</a></h3>
|
|
<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>
|
|
<p>
|
|
CreateFormField calls CreatePart with a header using the
|
|
given field name.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 id="Writer.CreateFormFile">func (*Writer) <a href="http://localhost:6060/src/mime/multipart/writer.go?s=3106:3184#L114">CreateFormFile</a></h3>
|
|
<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>
|
|
<p>
|
|
CreateFormFile is a convenience wrapper around CreatePart. It creates
|
|
a new form-data header with the provided field name and file name.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 id="Writer.CreatePart">func (*Writer) <a href="http://localhost:6060/src/mime/multipart/writer.go?s=2132:2207#L75">CreatePart</a></h3>
|
|
<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>
|
|
<p>
|
|
CreatePart creates a new multipart section with the provided
|
|
header. The body of the part should be written to the returned
|
|
Writer. After calling CreatePart, any previous part may no longer
|
|
be written to.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 id="Writer.FormDataContentType">func (*Writer) <a href="http://localhost:6060/src/mime/multipart/writer.go?s=1647:1692#L58">FormDataContentType</a></h3>
|
|
<pre>func (w *<a href="index.html#Writer">Writer</a>) FormDataContentType() <a href="../../builtin/index.html#string">string</a></pre>
|
|
<p>
|
|
FormDataContentType returns the Content-Type for an HTTP
|
|
multipart/form-data with this Writer's Boundary.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 id="Writer.SetBoundary">func (*Writer) <a href="http://localhost:6060/src/mime/multipart/writer.go?s=950:1001#L34">SetBoundary</a></h3>
|
|
<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>
|
|
<p>
|
|
SetBoundary overrides the Writer's default randomly-generated
|
|
boundary separator with an explicit value.
|
|
</p>
|
|
<p>
|
|
SetBoundary must be called before any parts are created, may only
|
|
contain certain ASCII characters, and must be non-empty and
|
|
at most 69 bytes long.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 id="Writer.WriteField">func (*Writer) <a href="http://localhost:6060/src/mime/multipart/writer.go?s=3810:3868#L133">WriteField</a></h3>
|
|
<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>
|
|
<p>
|
|
WriteField calls CreateFormField and then writes the given value.
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div id="footer">
|
|
Build version go1.6.<br>
|
|
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>,
|
|
the content of this page is licensed under the
|
|
Creative Commons Attribution 3.0 License,
|
|
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br>
|
|
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> |
|
|
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a>
|
|
</div>
|
|
|
|
</div><!-- .container -->
|
|
</div><!-- #page -->
|
|
|
|
<!-- TODO(adonovan): load these from <head> using "defer" attribute? -->
|
|
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script>
|
|
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script>
|
|
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script>
|
|
|
|
|
|
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script>
|
|
|
|
</body>
|
|
</html>
|
|
|