我使用了模板 yesod-simple 创建了一个脚手架。
处理程序 Home.hs 有以下几行:
-- Define our data that will be used for creating the form.
data FileForm = FileForm
{ fileInfo :: FileInfo
, fileDescription :: Text
}
提交表单后,开发网络服务器会显示:
-----------------------------11220121616194905281129768369 内容处置:表单数据;名称="f1"; filename="testfile" 内容类型:text/x-haskell
...
-----------------------------11220121616194905281129768369 内容处置:表单数据;名称="f2"
...
为什么这些 post 参数从“fileInfo”更改为“f1”,从“fileDescription”更改为“f2”?
现在使用 lookupPostParam 时,我需要使用“f1”和“f2”作为参数而不是原始字段名称......