digiplant / play-res Goto Github PK
View Code? Open in Web Editor NEWResource plugin for Play Framework 2
License: Other
Resource plugin for Play Framework 2
License: Other
when i try to use the file from the MultiFormData, I get following error:
overloaded method value put with alternatives: (x$1: play.mvc.Http.MultipartFormData.FilePart)String (x
$1: java.io.File)String cannot be applied to
(play.api.mvc.MultipartFormData.FilePart[play.api.libs.Files.TemporaryFile])
it's because I get play.api.mvc.MultipartFormData.FilePart[play.api.libs.Files.TemporaryFile] from the request.body, but Res.put() expects play.mvc.Http.MultipartFormData.FilePart.
Do I use it wrong or is it a versioning error (play! 2.1.3, play-res 1.0, scala 2.10.0)?
this is my code:
def upload = Action { implicit request =>
val file = for {
body <- request.body.asMultipartFormData
uploaded <- body.file("file")
} yield uploaded
file match {
case Some(f) => {
val id: String = Res.put(f)
Ok(Json.obj("url" -> id))
}
case _ => BadRequest(Json.obj("error" -> "upload_error"))
}
}
I am using play-scalr for resizing images, Image upload fails on when I do Res.put with following exceptions
https://gist.github.com/pankajmi/7611800
This works fine on Mac though. I change the tmp folder on windows thinking it could be folder permission issue, but I find the same problem. I check the java process through process monitor and somewhere it says file is locked.
Process monitor log -
12:20:53.2390538 PM java.exe 4016 CreateFileMapping C:\Users\varsha agrawal\AppData\Local\Temp\multipartBody8496473752295517185asTemporaryFile FILE LOCKED WITH ONLY READERS SyncType: SyncTypeCreateSection, PageProtection: PAGE_READONLY
Can you help me here ?
I have stackoverflow link that I opened today -
http://stackoverflow.com/questions/20159290/apche-commons-movefile-method-fails-in-windows
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.