Skip to content

Instantly share code, notes, and snippets.

@futurechimp
Created March 12, 2012 19:58
Show Gist options
  • Save futurechimp/2024336 to your computer and use it in GitHub Desktop.
Save futurechimp/2024336 to your computer and use it in GitHub Desktop.
// This action receives the file upload.
post("/upload") {
processFile(fileParams("somefile"))
}
// This method processes the uploaded file in some way.
private def processFile(upload:FileItem) = {
val filePath:String = "/some/place/to/store/the/file"
val file:File = new File(filePath + upload.getName)
upload.write(file);
// Coming from Ruby, so I'm wondering:
// Do I need to do anything here to close the File or FileItem? Should I use a loan pattern or something?
}
@futurechimp
Copy link
Author

The ross say this is alright - we don't need to close anything else here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment