<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">On 08/18/2014 07:47 AM, Royce Lv wrote:<br>
</div>
<blockquote cite="mid:53F1D9BC.4080709@linux.vnet.ibm.com"
type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
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 moz-do-not-send="true"
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 moz-do-not-send="true"
class="moz-txt-link-freetext"
href="https://groups.google.com/forum/#%21topic/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 moz-do-not-send="true"
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 moz-do-not-send="true" 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 moz-do-not-send="true"
class="moz-txt-link-freetext"
href="http://github.com/23/resumable.js">http://github.com/23/resumable.js</a><br>
<br>
</blockquote>
<br>
About the progress bar, we need to store it on backend to make this
info available to all users.<br>
I think we can use the same approach to upload/download.<br>
<br>
<blockquote cite="mid:53F1D9BC.4080709@linux.vnet.ibm.com"
type="cite">
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Kimchi-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Kimchi-devel@ovirt.org">Kimchi-devel@ovirt.org</a>
<a class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/kimchi-devel">http://lists.ovirt.org/mailman/listinfo/kimchi-devel</a>
</pre>
</blockquote>
<br>
</body>
</html>