Florent, What did you use to post? I did a bit of testing a while back in which I posted multipart from a browser, using a form like this:
<form action="default.xqy" method="POST" enctype="multipart/form-data"> <input type="file" name="attachment" size="100"/> Perhaps different from your approach, but this seemed to work okay for me. Kind regards, Geert > -----Oorspronkelijk bericht----- > Van: Florent Georges [mailto:[email protected]] > Verzonden: maandag 12 november 2012 11:41 > Aan: Geert Josten; MarkLogic Developer Discussion > Onderwerp: Re: [MarkLogic Dev General] Analyzing HTTP multipart request? > > Geert Josten wrote: > > Hi, > > > Can you give some kind of test case? I thought MarkLogic should > > be able to handle multipart requests properly.. > > Sure. Let's consider the example 5.2 in the RFC 2387 for > instance, at http://tools.ietf.org/html/rfc2387#section-5.2. If > you post it to the following query (using your favorite HTTP > tool): > > xquery version "1.0-ml"; > > <results> { > for $b in xdmp:get-request-body() > return > <result> { > (: Transform binary() to xs:base64Binary :) > (: To avoid type error, cannot add binary() to element :) > if ( $b instance of document-node() and > $b/node() instance of binary() ) then > xs:base64Binary($b/node()) > else > $b > } > </result> > } > </results> > > then I get the following result (only one body): > > <results><result>LS1leGFtcGxlLTIKQ29udGV [...]</result></results> > > I've truncated it here, but when I base64-decode the returned > result, I get back the entire multipart request entity content > (AKA its "body"). Which means that in that case, the multipart is > not decoded, it is returned to the query as a big binary chunck. > > So I wonder if there is another API call to get the decoded > multipart content (in the above example as three different > contents, one text and 2 binary pictures), or if there is a > library to rather decode the big binary returned by > xdmp:get-request-body()? > > Regards, > > -- > Florent Georges > http://fgeorges.org/ > http://h2oconsulting.be/ _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
