1. Backend:
(1)API definition:
POST /storagepools/isos/storagevolumes/upload {'file':
fileobject} -- This is from backend view, as cherrypy's embedded
support wraps fileobject.
REF:http://docs.cherrypy.org/en/latest/pkg/cherrypy.tutorial.html?highlight=upload
(2) implementation:
We can get the file handler from cherrypy's embedded
scheme, and use it to read and write to a local file, ref:
https://groups.google.com/forum/#!topic/cherrypy-users/xGvxBGgQ90k
The only thing we need to concern at backend is the file
size, cherrypy demo has proposed a example leverage cgi lib:
http://tools.cherrypy.org/wiki/DirectToDiskFileUpload
2. For UI, we need to supply user with a form which input type is
'file', or we construct formdata in ajax(for IE only supported in
IE10+):
REF:
http://stackoverflow.com/questions/6974684/how-to-send-formdata-objects-with-ajax-requests-in-jquery
3. To support the progress bar in UI, we can utilize
resumable js: http://github.com/23/resumable.js