Created
March 12, 2012 19:58
-
-
Save futurechimp/2024336 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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? | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The ross say this is alright - we don't need to close anything else here.