Hi Florent, You are not the first to observe this problem. See here: http://markmail.org/message/yiol6zavpqkzyqlc
I recommend filing a bug to [email protected]. Kind regards, Geert > Drs. G.P.H. Josten Consultant http://www.daidalos.nl/ Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 http://www.daidalos.nl/ KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. > From: [email protected] > [mailto:[email protected]] On Behalf Of > Florent Georges > Sent: zondag 6 december 2009 23:16 > To: MarkLogic General ML > Subject: [MarkLogic Dev General] Uploading a binary file from > an HTML form to the HTTP app server > > Hi, > > I try to upload a binary file to MarkLogic, but it seems > the result of xdmp:get-request-field('file') seems to be > always of length 0. Here is a simple repro: > > <!-- upload.html --> > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <title>What did I do wrong?</title> > </head> > <body> > <form action="upload.xqy" method="post" > enctype="multipart/form-data"> > <p> > File: <input type="file" name="file"/> > <input type="submit" value="Go!"/> > </p> > </form> > </body> > </html> > > (: upload.xqy :) > xquery version "1.0"; > > declare namespace xdmp = "http://marklogic.com/xdmp"; > > let $filename := xdmp:get-request-field-filename('file') > let $dispo := fn:concat('attachment; filename="', $filename, '"') > let $x := xdmp:add-response-header('Content-Disposition', $dispo) > let $x:= xdmp:set-response-content-type( > xdmp:get-request-field-content-type('file')) > return > xdmp:get-request-field('file') > > This is based on the example in the xdmp:get-request-field > doc > <http://xqzone.marklogic.com/pubs/4.1/apidocs/AppServerBuiltin > s.html#xdmp:get-request-field>. > > If you put those two files on your HTTP app server, access > the HTML file, fill in the form and submit it, you get your > file back, with the same MIME type and filename, but the > content is empty. > > I guess I missed the obvious, but I cannot see what I did wrong. > > Regards, > > -- > Florent Georges > http://www.fgeorges.org/ > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > General mailing list > [email protected] > http://xqzone.com/mailman/listinfo/general > _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
