I think this will be helpful. At least when it comes to Java. Actualy, have a look at whole tutorial

Here is an example how to do it by using Spring:

Add commons-io and commons-fileupload dependencies to your pom.xml. Configure multipart resolver in your servlet context xml file:

&lt;beans:bean id="multipartResolver"
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver"&gt;
        &lt;beans:property name="maxUploadSize" value="10000000" /&gt;
&lt;/beans:bean&gt;


This will be your JSP for upload of files (i.e. fileUpload.jsp):

&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%&gt;
&lt;%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
&lt;title&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;form:form method="post" commandName="upload" action="uploadNewFile"
        enctype="multipart/form-data"&gt;
        &lt;table class="table table-bordered"&gt;
            &lt;tbody&gt;
                &lt;tr&gt;
                    &lt;td&gt;&lt;label&gt;File&lt;/label&gt;&lt;/td&gt;
                    &lt;td&gt;&lt;input class="form-control" name="file" type="file"
                        id="file" /&gt;&lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td colspan="2"&gt;&lt;input class="btn btn-primary" type="submit"
                        value="Upload" /&gt;&lt;/td&gt;
                &lt;/tr&gt;
            &lt;/tbody&gt;
        &lt;/table&gt;
    &lt;/form:form&gt;
&lt;/body&gt;
&lt;/html&gt;


And this is controller:

import java.io.IOException;

import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class UploadController {

    // Show page for upload
    @RequestMapping(value = "/fileUpload", method = RequestMethod.GET)
    public ModelAndView showUploadFilePage() {
        return new ModelAndView("fileUpload", "upload", null);
    }

    // Get multipart file and save it
    @RequestMapping(value = "/uploadNewFile", method = RequestMethod.POST)
    public String save(@RequestParam("file") MultipartFile file) {
        // Save it to i.e. database
        // dao.save(file);
        return "fileUpload";
    }

    // Downloads file. I.e. JPG image
    @RequestMapping(value = "/download/{id}", produces = MediaType.IMAGE_JPEG_VALUE)
    public @ResponseBody HttpEntity&lt;byte[]&gt; getFile(
        @PathVariable("id") Integer id) throws IOException {

        byte[] file= dao.get(id).getImage();
        HttpHeaders header = new HttpHeaders();
        header.set("Content-Disposition", "attachment; filename=Image");
        header.setContentLength(file.length);

        return new HttpEntity&lt;byte[]&gt;(file, header);
    }
}


Upload/Download File using REST or Web Services
When does yielding occur in relation to dice resolution? Simultaneously? After all dice have resolved? After attack dice are resolved?

For example (A for attack die, H for heart):

Alice is outside Tokyo, Bob is inside. It is now Alice's turn.
Alice rolls: 3, 3, 3, A, A, H
? Handle VP and hearts?
Alice attacks Bob
Bob chooses to yield


Now consider the possibility Alice has a single shrink ray token, so she only rolls 5 dice:

Alice is outside Tokyo, Bob is inside. It is now Alice's turn.
Alice rolls: 3, 3, 3, A, H
? Handle VP and hearts?
Alice attacks Bob
Bob chooses to yield


She must choose if the heart is applied to heal for one, or if it will remove the shrink ray token. In this case, order of resolution for the attack/yield and heart matters (more/less information for Alice &amp; Bob, inability to heal in Tokyo). Is there an order to the dice resolution (eg hearts then attacks), or is the yield not declared until after all dice have resolved?
