<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
1. Backend:<br>
(1)API definition:<br>
POST /storagepools/isos/storagevolumes/upload {'file':
fileobject} -- This is from backend view, as cherrypy's embedded
support wraps fileobject.<br>
REF:<tt><big><big><a class="moz-txt-link-freetext" href="http://docs.cherrypy.org/en/latest/pkg/cherrypy.tutorial.html?highlight=upload">http://docs.cherrypy.org/en/latest/pkg/cherrypy.tutorial.html?highlight=upload</a></big></big></tt><tt><big><br>
<br>
(2) implementation:<br>
We can get the file handler from cherrypy's embedded
scheme, and use it to read and write to a local file, ref:<br>
<a class="moz-txt-link-freetext" href="https://groups.google.com/forum/#!topic/cherrypy-users/xGvxBGgQ90k">https://groups.google.com/forum/#!topic/cherrypy-users/xGvxBGgQ90k</a><br>
The only thing we need to concern at backend is the file
size, cherrypy demo has proposed a example leverage cgi lib:<br>
<a class="moz-txt-link-freetext" href="http://tools.cherrypy.org/wiki/DirectToDiskFileUpload">http://tools.cherrypy.org/wiki/DirectToDiskFileUpload</a></big></tt><br>
<br>
<br>
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+):<br>
REF: <tt><br>
<a class="moz-txt-link-freetext" href="http://stackoverflow.com/questions/6974684/how-to-send-formdata-objects-with-ajax-requests-in-jquery">http://stackoverflow.com/questions/6974684/how-to-send-formdata-objects-with-ajax-requests-in-jquery</a><br>
<br>
<big>3. To support the progress bar in UI, we can utilize
resumable js: </big></tt><a class="moz-txt-link-freetext"
href="http://github.com/23/resumable.js">http://github.com/23/resumable.js</a><br>
</body>
</html>