Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7502147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:45:59+00:00 2026-05-29T20:45:59+00:00

This is the document of how to uploading a file in play2: https://github.com/playframework/Play20/wiki/ScalaFileUpload But

  • 0

This is the document of how to uploading a file in play2: https://github.com/playframework/Play20/wiki/ScalaFileUpload

But I have another question: Can’t we use the play1’s way anymore?

In play1, I can upload a file as following:

routes
--------
post    /upload         Application.upload

Application.java
----------------
public static void upload(File file) { ... }

The action upload will get the uploaded file automatically.

But how to do the same in play2?

I tried:

routes:
--------
POST   /upload         controllers.Application.upload

Application.scala
-----------------
def upload(file: File) = Action { ...}

But it can’t compiled, the error message is:

not enough arguments for method upload: (file: java.io.File)

Then I add a parameter to routes:

POST   /upload         controllers.Application.upload(file: java.io.File)

It still reports error:

No QueryString binder found for type java.io.File. Try to implement an implicit QueryStringBindable for this type.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T20:46:01+00:00Added an answer on May 29, 2026 at 8:46 pm

    Files are passed in HTTP requests body, but in Play 2 the parameters of an action can only be bound to the URL path or the query string [1]. You need to retrieve uploaded files from the request body, in your action body, as explained in the documentation [2].

    [1] https://github.com/playframework/Play20/wiki/ScalaRouting
    [2] https://github.com/playframework/Play20/wiki/ScalaFileUpload

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a longshot but I have a file with something like this: document
I am using 'git' to checkout chromium code by following this document: http://code.google.com/p/chromium/wiki/UsingGit And
I already search about this and I cannot use ajax in file uploading, but
Hai I have An XDocument .All nodes in this document have an attribute UserId.
Considering this xml document: DECLARE @X XML (DOCUMENT search.SearchParameters) = '<parameters xmlns=http://www.educations.com/Search/Parameters.xsd xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance> <parameter
Page of interest: https://www.gsb-yourbank.com/test/ ICO file: https://www.gsb-yourbank.com/test/favicon.ico My favicon is a 16x16 resolution, 16-color
I have got this JavaScript code for uploading files to my server (named it
I have one link http://devappandroid.com/Android_App/test_uploada%20.html on that i am uploading A Image and as
I have a piece of code that allow users download file from server (document
I have a script that if user is uploading file and try to close

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.