Implement js guard against large file uploads.

TODO @stvstnfrd to review changes