Re: [Xsltforms-support] file uploads
Brought to you by:
alain-couthures
From: Tim T. <tim...@gm...> - 2017-01-31 17:20:58
|
Hi, Conal, I'm not sure about the support for different serialization formats, but I did just test <xf:upload> with rev.638, and it worked for me (on Ubuntu): <xf:upload incremental="true" mediatype="application/xml" ref="instance('file-upload')/upload/file"> <xf:label>Select</xf:label> <xf:filename ref="instance('file-upload')/upload/file/@filename"/> <!-- Relative XPath doesn't seem to work here. --> </xf:upload> When I upload a file, the file contents are inserted into the <file> element in my "file-upload" instance, and I am able to POST the contents to a server. When I do an upload, I get a relative file name (no file:///). Hope this helps, Tim -- Tim A. Thompson Metadata Librarian (Spanish/Portuguese Specialty) Princeton University Library www.linkedin.com/in/timathompson ta...@pr... On Sun, Jan 29, 2017 at 9:02 AM, Conal Tuohy <con...@gm...> wrote: > I have had a lot of difficulty in getting a file upload to work, in > XSLTForms rev.638, on either Firefox 50.1.0 or Chrome 55.0.2883.87 on > Linux Mint. > > What I am trying to do is use an <xf:upload> to load a local XML file, and > submit it to a web service which will convert it into some other format. > The web service expects an HTTP POST, but I believe it is happy with a > serialization of "application/xml" or "multipart/form-data" and possibly it > may work with "multipart/related". I have tried the various XForms methods > "post", "form-data-post", and "multipart-post" without success. > > I have tried a number of things. > > It appears to me that the "form-data-post" submission method is not > supported by XsltForms at all > > It seems (from reading the JS code) that the "multipart-post" IS > supported, however, it fails to correctly serialize my instance containing > the file:/// URI set by my xf:upload (the XML containing the URI is sent > instead of the content which the URI refers to, even though I have set the > xsi:type="xsd:anyURI"). The same problem happens with the "post" method. > > Is this known behaviour? I am puzzled because the W3 XForms 1.1 test suite > results at http://www.agencexml.com/xforms-tests/testsuite/ > XForms1.1/Edition1/driverPages/forms/XF11_TestSuite.xhtml indicate that > "form-data-post" should work. > > I would appreciate any clarification about this is supposed to work, or > advice as to what functionality is missing. > > Thanks! > > > Conal > > > > -- > Conal Tuohy > http://conaltuohy.com/ > @conal_tuohy > +61-466-324297 <+61%20466%20324%20297> > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support > > |