How to upload multiple files in Play Framework using Java
<p>Hi i have been trying to upload image file in Play Framework. I have been trying out with Java File Upload since morning but unable to do so. I have seen <code>[JavaFileUpload][1]</code> tutorial available on framework website. But i am still not successful. Here is my code which i am trying to run:</p>

<pre><code>Http.MultipartFormData body = request().body().asMultipartFormData();        
List&lt;Http.MultipartFormData.FilePart&gt; fileParts = body.getFiles();
     for (Http.MultipartFormData.FilePart filePart : fileParts) {
             String filename = filePart.getFilename();
             File file = filePart.getFile(); //error comes on this line

             if (filePart.getFilename().toLowerCase().endsWith(".png")) { 
                //saving here but how?

             } else {
                  return badRequest("Invalid request, only PNGs are allowed.");

             }
         }
</code></pre>

<p>but problem is that whenever i try to get the file i am having this conversion error:</p>

<pre><code>java.lang.Object cannot be converted to java.io.File
</code></pre>

<p>Anyone can guide me in the direction? if we see the official document there is no proper documentation on how to upload multiple files. If anyone can show me some website which can helps me in that direction that will be also helpful</p>