1

I am looking for an example of using Ajax to upload multiple files in Play java framework.

This is the HTML form:

<form>
    <input type="file" id="multiplefiles" multiple required>
    <button type="submit" id="button">Upload</button>
</form>

And this is the only thing I found in Play documentation:

public static Result upload() {
     File file = request().body().asRaw().asFile();
     return ok("File uploaded");
}

I don't know how to send the files via Ajax and how to split them in Play.

BTW, I was able to do it via the form action.

Amin
  • 111
  • 9
  • 1
    possible duplicate of [How to upload multiple files using PHP, jQuery and AJAX](http://stackoverflow.com/questions/19295746/how-to-upload-multiple-files-using-php-jquery-and-ajax) – Cory Klein Sep 30 '14 at 16:12
  • @CoryKlein Thanks. I am more concerned about the Play side code. – Amin Sep 30 '14 at 18:58
  • from the server side there is no different. you can use the form action – roterl Sep 30 '14 at 19:15

0 Answers0