File upload file size limit Play 2.2.1

1,158 views
Skip to first unread message

Michael Nguyen

unread,
Feb 5, 2014, 2:24:34 AM2/5/14
to play-fr...@googlegroups.com
I followed the tips and links on this page: https://github.com/playframework/playframework/pull/884

However, I found that none of those solutions solves the issues for files over 2GB.  I set the property parser.MultipartFormData.maxLength to any number  above 2GB and all attempts fail.  

application.conf:
parsers.MultipartFormData.maxLength=5000000K


This code results in a null pointer for formBody.

            RequestBody body = request().body();
           
MultipartFormData formBody = body.asMultipartFormData();




inspecting "body" I see the isExceedsSizeLimit(?) is set to true. 


What can be done?  I don't see anything in the documentation or the discussion groups that provide an answer to this?  Is this a limitation of the framework?  


Thanks,
Michael 

Kevin Sheppard

unread,
Feb 8, 2014, 8:09:43 PM2/8/14
to play-fr...@googlegroups.com
I believe this is due to a limitation of HTTP and not your code. It looks like uploading files > 2GB uwing HTTP can cause problems. 

Michael Nguyen

unread,
Feb 8, 2014, 9:17:45 PM2/8/14
to play-fr...@googlegroups.com
I found a similar article.  was hoping somebody found a way around it.




--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/qqHT5n1rLkk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
----------------------------
Michael Nguyen

Ngoc

unread,
Feb 9, 2014, 11:11:36 PM2/9/14
to play-fr...@googlegroups.com
I guess you can try JS upload libraries based on Flash, not normal form multipart/form-data.

Kevin Sheppard

unread,
Feb 10, 2014, 7:20:20 AM2/10/14
to play-fr...@googlegroups.com

Yes I think Flash is your best option when trying to do that type of file transfer. Just keep in mind that if you plan on providing a mobile version of your site, that the flash component is not guaranteed to work.

--

Adam Hooper

unread,
Feb 10, 2014, 10:58:05 AM2/10/14
to play-fr...@googlegroups.com
On Sunday, February 9, 2014 11:11:36 PM UTC-5, Ngoc wrote:
I guess you can try JS upload libraries based on Flash, not normal form multipart/form-data.

If you're trying to avoid multipart/form-data, you needn't use Flash. Can't an XMLHttpRequest do the trick?

I've tested using https://github.com/overview/js-mass-upload; it seems that uploading one chunk larger than 2GB will break Webkit because the progress event's "loaded" value is an int. But the "total" value isn't, so it should take little effort to only upload a chunk at a time. Hopefully Firefox would work with that, too.

Play integrates nicely with js-mass-upload if you build a separate BodyParser. See https://github.com/overview/overview-server/blob/master/app/controllers/MassUploadController.scala for an example, and read the js-mass-upload README for API ideas. (Overview's MassUploadController is restricted to 2GB anyway, because it writes to Postgres large objects; but the protocol can go to an unlimited size.) A Silverlight plugin can lend support to earlier IE versions via an HTML5 File API shim; see https://github.com/overview/overview-server/tree/master/ext/silverlight/file-upload for a (no-longer-used-or-tested) shim that works and integrates with XMLHttpRequest file uploads.

IMO, if you're going to use Flash, Silverlight or Java plugins, you should make them HTML5 shims; HTML5 will soon be the most compatible of them all.

Enjoy life,
Adam

Will Sargent

unread,
Feb 10, 2014, 11:55:03 AM2/10/14
to play-fr...@googlegroups.com
There is a stackoverflow answer that may be helpful:

http://stackoverflow.com/a/19089866

Will Sargent
Consultant, Professional Services
Typesafe, the company behind Play Framework, Akka and Scala


--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages