Upload a file from Play webapp to another website using java.io.FileInputStream with Scala -


in controller defined method upload supposed stream file uploaded user third party website (like dropbox or box.com) via website. limit javaapi (for wrote wrapper). have give java.io.fileinputstream don't know how.

this method:

def upload(parentid: string) = action.async { implicit request =>     authorized(request, { user =>       val body = request.body.asmultipartformdata        // somehow have transform body request fileinputstream        val stream: fileinputstream = new fileinputstream(file)        apijava.pseudoupload(user.token, parentid, stream);       redirect(routes.application.showfolder(parentid))     })   } 

the request send standard

@helper.form(action = routes.file.pseudoupload(currentid), 'enctype -> "multipart/form-data") {                 <input type="file" name="upoadthis">                 <input type="submit">                 } 

your appreciated!

i'd this:

def upload(parentid: string) = action.async(parse.multipartformdata) { implicit request =>     authorized(request, { user =>       request.body.file("upoadthis").map { uploadthis =>         new fileinputstream(receivedfile.ref.file)         ... 

that stores file temporarily disk, before streaming out dropbox or whoever.

see documentation more on this.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -