how to get the size of video or audio file in KB in scala.
tried this but it doesnt help me How to find file size in scala?
size
and length
always returning 1.
def uploadVideo = Action.async(parse.multipartFormData) { implicit request =>
request.body.files.map { mov =>
println(request.body.files.size) //returns 1
println(request.body.files.length)//returns 1
}
Ok("success")
}
finaly by some hit and try i got the solution
def uploadVideo = Action.async(parse.multipartFormData) { implicit request =>
request.body.files.map { mov =>
println(mov.ref.file.length/1024)//exact in KB
}
Ok("success")
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.