Browse Source

PostForm() handles multipart post

Manu Mtz-Almeida 10 years ago
parent
commit
500d745123
1 changed files with 6 additions and 3 deletions
  1. 6 3
      context.go

+ 6 - 3
context.go

@@ -30,8 +30,6 @@ const (
 
 
 const AbortIndex = math.MaxInt8 / 2
 const AbortIndex = math.MaxInt8 / 2
 
 
-var _ context.Context = &Context{}
-
 // Param is a single URL parameter, consisting of a key and a value.
 // Param is a single URL parameter, consisting of a key and a value.
 type Param struct {
 type Param struct {
 	Key   string
 	Key   string
@@ -76,6 +74,8 @@ type Context struct {
 	Accepted []string
 	Accepted []string
 }
 }
 
 
+var _ context.Context = &Context{}
+
 /************************************/
 /************************************/
 /********** CONTEXT CREATION ********/
 /********** CONTEXT CREATION ********/
 /************************************/
 /************************************/
@@ -231,10 +231,13 @@ func (c *Context) query(key string) (string, bool) {
 
 
 func (c *Context) postForm(key string) (string, bool) {
 func (c *Context) postForm(key string) (string, bool) {
 	req := c.Request
 	req := c.Request
-	req.ParseForm()
+	req.ParseMultipartForm(32 << 20) // 32 MB
 	if values, ok := req.PostForm[key]; ok && len(values) > 0 {
 	if values, ok := req.PostForm[key]; ok && len(values) > 0 {
 		return values[0], true
 		return values[0], true
 	}
 	}
+	if values, ok := req.MultipartForm.Value[key]; ok && len(values) > 0 {
+		return values[0], true
+	}
 	return "", false
 	return "", false
 }
 }