Skip to content

Instantly share code, notes, and snippets.

View annovi's full-sized avatar

Andrea Annovi annovi

  • Vancouver - Canada
View GitHub Profile
@jrudolph
jrudolph / ClientFileUpload.scala
Created February 11, 2015 09:52
spray file upload example
import akka.actor.ActorSystem
import spray.client.pipelining._
import spray.http.{MediaTypes, BodyPart, MultipartFormData}
object UploadFileExample extends App {
implicit val system = ActorSystem("simple-spray-client")
import system.dispatcher // execution context for futures below
val pipeline = sendReceive
val payload = MultipartFormData(Seq(BodyPart(new File("/tmp/test.pdf"), "datafile", MediaTypes.`application/pdf`)))