Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.artezio.cv.http
- import unfiltered.request._
- import unfiltered.response._
- import unfiltered.netty._
- import unfiltered.netty.request._
- object Main extends App {
- Http(8080).chunked().handler(cycle.Planify {
- case GET(Path("/")) =>
- ResponseString(
- """
- |<form action="/upload" method="post" enctype="multipart/form-data">
- |CV: <input type="file" name="f"/>
- |<input type="submit" value="Submit"/>
- |</form>
- """.stripMargin)
- case POST(Path("/upload") & MultiPart(req)) =>
- val disk = MultiPartParams.Disk(req)
- (disk.files("f"), disk.params("p")) match {
- case (Seq(f, _*), p) =>
- ResponseString(
- "cycle disk read file f named %s with content type %s and param p %s" format(
- f.name, f.contentType, p))
- case _ => ResponseString("what's f?")
- }
- }).run()
- }
Advertisement
Add Comment
Please, Sign In to add comment