Hi all, I'm a student currently taking a course on Haskell, and for my final project, I'm looking to add file upload capability to Snap.
Right now, I'm trying to figure out how to implement this, and I'd love any input the community has on how this should and be exposed at the end. I believe a big piece of it will be, more generally, having a way dealing with forms that have the Content-Type of "multipart/form-data", since rqParam only gets POST parameters whose Content-Type is "application/x-www-form-urlencoded." Then, going from that, there will need to be some interface for handling (and potentially saving?) the file data passed, while letting the user have a high degree of control over what gets done. I've looked through the source where Yesod handles this, and it seems their approach is to have, when their requests are parsed, the body goes into an "IO thunk", such that any POST requests are processed at-most once, but also don't necessarily have to be processed at all. The request body is then represented as a tuple, where the first element is [(paramName, paramValue)], and the second is [(paramName, fileInfo)], where fileInfo is the file name, content type, and content. ( https://github.com/snoyberg/yesod/blob/master/Yesod/Request.hs) This seems like a reasonable idea of structuring things, but I'm not really in a position to judge at this point. Any advice would be appreciated. Cheers, Dan
_______________________________________________ Snap mailing list [email protected] http://mailman-mail5.webfaction.com/listinfo/snap
