File upload is a very basic HTTP operation handled through Content-type: multipart/form-data. In this recipe, we will create an HTML form and upload a file through it. While the file is being uploaded, we will dynamically process the contents, and report the summary.
File upload with Snap
How to do it...
- Create a new project, file-upload, with a simple stack template:
stack new file-upload simple
- Add a dependency on the snap-core library in the build-depends subsection of the executable section, as follows:
executable file-upload hs-source-dirs: src main-is: Main.hs default-language: Haskell2010 build-depends: base >= 4.7 && < 5 ,...