Search code examples
haskellmultipart

Haskell how to parse file uploads/multipart form data using Hack?


I'm creating a simple Hack2 app, and I can read body data with:

directory :: Application
directory env = do 
    body <- input_bytestring env
    ...

I'm trying to switch my form to use file uploads

<form action="/directory" method="POST" enctype='multipart/form-data'>
    <div><input type="file" name="data"></div>
    <div><input type="submit"></div>
</form>

But it's giving me a ShortWriteException. Maybe input_bytestring can't handle multipart. Is there a library that can handle multipart form data? Any examples of doing this with Hack2?


Solution

  • I never did figure this out. I switched to Happstack-lite, because I couldn't figure this out, and it seems like nobody is using Hack2.