Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

Question:How to copy an uploaded file in Play Framework?


I'm trying to do a basic file upload in Play 2.0.4. The file upload itself works, and I manage to get a File object. However, I want to copy this file into the /public/images/ directory. How can I do that? The following code produces no result or errors:
    FilePart picture = body.getFile("file");
    File file = picture.getFile();
        File dest = new File("../../public/images/new.png");
        Logger.debug("get destination: " + dest.getAbsolutePath() );
        return ok( file.getAbsolutePath() );
    catch (Exception e)
        return ok(images.render(false, e.toString()));

asked Sep 13, 2013 in Java Interview Questions by rajesh
edited Sep 12, 2013
0 votes

Related Hot Questions

Government Jobs Opening