perwendel / spark

A simple expressive web framework for java. Spark has a kotlin DSL https://github.com/perwendel/spark-kotlin
Apache License 2.0
9.65k stars 1.56k forks source link

Improve multipart handling (file-uploads) #543

Open tipsy opened 8 years ago

tipsy commented 8 years ago

Currently you have to do:

request.attribute("org.eclipse.jetty.multipartConfig", new MultipartConfigElement("/temp"));
request.raw().getPart("uploaded_file") // "uploaded_file" is the html input name

While this isn't terrible, it could be prettier. Something like:

request.enableMultipart() // could call request.enableMultipart("/temp")
request.part("uploaded_file")
kshep92 commented 8 years ago

Has anyone submitted a pull request for this yet?

tipsy commented 8 years ago

Nope. I have one locally, where I just have a .part() method that upgrades the request automatically, but it only works with Jetty. I'm not sure how uploads work with other webservers, which is why I'm holding off on publishing it.

kshep92 commented 8 years ago

I guess until you're done, we could use a filter to do this for us.