W3C home > Mailing lists > Public > public-forms@w3.org > October 2009

immedate upload

From: Leigh L. Klotz, Jr. <Leigh.Klotz@Xerox.com>
Date: Wed, 28 Oct 2009 10:41:37 -0700
Message-ID: <4AE88251.8080307@Xerox.com>
To: public-forms@w3.org
Today I accepted  Action 2009-10-28.5 to show how to do "immediate 
upload" in XForms 1.1, with an eye towards gap analysis and possible 
syntactic sugar.  This message completes the action.

*Summary: *
In summary, this method works, but has some constraints, described below 
in "Gap Analysis."

*Detailed Results:*
I have completed a working round-trip example using Mozilla XForms.
When you select a local file with the upload control, the 
xforms-value-changed event causes a submission to send the image (from a 
second instance) to the server.  On xforms-submit-done, the XML data 
from the submission is expected to contain the server-side URI for the 
image.  An xf:setvalue copies this value into the main instance, from 
where it is displayed with xf:output/@mediatype='image/*'.

Feel free to try it out:


For simplicity and security, the test upload resource on the server does 
not do anything with the uploaded image, and always returns the same 
static URI for the icon resource.

*Gap Analysis:*
Instead of relying on the server to have a script which accepts the 
image and returns properly formatted XML, it would be nice to use the 
native HTTP PUT to store data, and obtain the new resource URI from the 
Location header defined in HTTP PUT in
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30 as follows:

  <submission id="put-icon" method="put" action="..." serialization="image/png" ref="instance('icons')/icon" replace="none">
    <action ev:event="xforms-submit-done">
         <setvalue ref="instance('main')/entry/icon" value="event('response-headers')/header[name='Location']/value" />

Additionally, it would be nice to use the mediatype from the upload 
itself for the value of serialization, again not something supported in 
XForms 1.1:

   <upload ref="instance('icons')/icon">
        <mediatype ref="@mediatype" />
        <label>Icon: </label>

   <submission ...>
       <serialization value="instance('icons')/icon/@mediatype" />

*Syntactic Sugar*
It might be nice to provide syntactic sugar for some of these 
operations, should they prove common.  Further discussion is necessary.

Received on Wednesday, 28 October 2009 17:42:06 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:48:38 UTC