Add Ajax file upload capabilities to SHtml, preferably using http://valums.com/ajax-upload/ as a front-end "working use case".
SHtml calling interface could be:
def ajaxFileUpload(func: (FileParamHolder) => Unit, jsFunc : Call, func : (String) => JsCmd, attrs : (String, String)*)
This would be consistent with other ajax interfaces and with file upload (non-Ajax).
See also plupload.com for nifty upload examples.
This one might relate to the now fixed raw access to post data for use cases with XHR HTML5 blob uploads.
We can't use Valums because the code is GPL.
I have to do more research into MIT or Apache plugins that we can use
I found this one http://aquantum-demo.appspot.com/file-upload and am trying to get that one working today. Once I'll do I push it to a self-contaned git repo on github. MIT licensed, so should be good(?).
Done. Check out https://github.com/mbk/ajaxupload_with_comet
Contains a /devtest link that includes the above mentioned UI as plain html/JS, and uploads to a DispatchPF. Works like a charm, how can I help to wrap this up?
I am in Norway until Saturday, but may have some spare time left; if you post me the example of one comet actor providing feedback (I think you made a project for that a few weeks ago, but can't find the thing from here), I'll try and write:
a) a complete piece of code in a blank project that does an Ajax upload with feedback and executes a function on upload
b) at least write in the Wiki "how it's done"
c) Maybe you'll see a quick way to "collapse" the code into a function on SHtml
Imported from Assembla: http://www.assembla.com/spaces/liftweb/tickets/745
There's some room to roll this into Lift by simply using the iframe-based upload mechanism that is the standard fallback for AJAX file upload and requires no external dependencies. See https://groups.google.com/forum/#!msg/liftweb/OuN1sqRMO_c/TrUGUaSvoN4J for more. The Lift Cookbook also includes alternate approaches guidance at http://cookbook.liftweb.net/#AjaxFileUpload .
I'm eyeballing adding the iframe approach to Lift 3 to avoid external libraries, and letting folks do it via plugins if they want more functionality.
@Shadowfiend It seems like there is File API support in at least the latest release of all major browsers. Should we be forward looking with Lift 3 and concentrate on that rather than an iframe based approach?
It's a question I'm still noodling, but my feeling is that we should be forward-thinking on the server-side, which we control completely, but be a little more deliberate about client-side decisions. It'd be nice if out-of-the-box solutions could at least be compatible through IE8 when it doesn't take too much hackery. Even IE9 doesn't support the file API.
Net-net, I'm a little torn on it. Maybe one possibility would be providing both and letting the developer choose.
This is something that could be configurable as a LiftRule if we provide both. Something like “use the file API if the browser supports it” with auto-fallback to iframe on the IE’s where it’s needed.