test.html
<h1>テストデータのアップロードページ</h1>
    <form name="upload" method="POST" action="/test/upload" enctype="multipart/form-data">
      <input type="file"   name="imgFile"  accept="image/jpeg, image/png">
      <input type="submit" name="submit"   value="commit">
    </form>
App.go
import (
	"github.com/revel/revel"
	"app/app/models"
	"fmt"
	"os"
)
func (c App) Test() revel.Result {
	return c.Render()
}
func (c App) Upload(imgFile *os.File) revel.Result {
  fmt.Printf("imgFile => %v\n", imgFile)
  return c.Redirect(App.Test)
}
imgFile => &{0xc0000a85a0}
### 画像の保存
– ioutil.WriteFile(path, data, permission)で画像を保存する
import (
	"github.com/revel/revel"
	"app/app/models"
	"fmt"
	"io/ioutil"
	"os"
)
func (c App) Upload(imgFile *os.File) revel.Result {
  fmt.Println(c.Params.Files["imgFile"][0].Filename)
  name := c.Params.Files["imgFile"][0].Filename
  data, e := ioutil.ReadAll(imgFile)
  if e != nil {
	fmt.Println("error")
  }
  ioutil.WriteFile("public/tmp/" + name, data, 755)
  return c.Redirect(App.Test)
}

おおお、なんか久しぶりに感動した。
 
					 
