X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=examples%2FMultipart.hs;fp=examples%2FMultipart.hs;h=8ddc6189be39a8ad942d372671819fd6f066e53f;hp=9c42e7269a4984452d8914aea1644ba02891f1eb;hb=ece223c516e66223ef1d5d8e6bbe4054a235d983;hpb=9668dc27a02b59d7bfb1e9e40af3d2619700ad69 diff --git a/examples/Multipart.hs b/examples/Multipart.hs index 9c42e72..8ddc618 100644 --- a/examples/Multipart.hs +++ b/examples/Multipart.hs @@ -21,21 +21,21 @@ resMain ∷ ResourceDef resMain = emptyResource { resGet - = Just $ do setContentType $ mkMIMEType "text" "html" - output ("Multipart Form Test\n" ⊕ - "
\n" ⊕ - " Upload some file:\n" ⊕ - " \n" ⊕ - " \n" ⊕ - " \n" ⊕ - "
\n") + = Just $ do setContentType $ parseMIMEType "text/html" + putChunks $ "Multipart Form Test\n" + ⊕ "
\n" + ⊕ " Upload some file:\n" + ⊕ " \n" + ⊕ " \n" + ⊕ " \n" + ⊕ "
\n" , resPost - = Just $ do form ← inputForm defaultLimit + = Just $ do form ← getForm Nothing let text = fromMaybe (∅) $ fdContent <$> lookup "text" form file = fromMaybe (∅) $ fdContent <$> lookup "file" form fileName = fdFileName =≪ lookup "file" form - setContentType $ mkMIMEType "text" "plain" - outputChunk ("You entered \"" ⊕ text ⊕ "\".\n") - outputChunk ("You uploaded a " ⊕ Lazy.pack (show $ Lazy.length file) ⊕ " bytes long file.\n") - output ("The file name is " ⊕ Lazy.pack (show fileName) ⊕ ".\n") + setContentType $ parseMIMEType "text/plain" + putChunks $ "You entered \"" ⊕ text ⊕ "\".\n" + putChunks $ "You uploaded a " ⊕ Lazy.pack (show $ Lazy.length file) ⊕ " bytes long file.\n" + putChunks $ "The file name is " ⊕ Lazy.pack (show fileName) ⊕ ".\n" }