Hi Keith,

I cannot make it work either. Even the example from Mark Logic itself is 
failing:

http://developer.marklogic.com/pubs/4.1/apidocs/AppServerBuiltins.html#xdmp:get-request-field

I am running on 32-bit MarkLogic Server 4.1-3. I am pretty certain that this 
method was working in earlier versions of MarkLogic Server. I recommend 
contacting support..

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
www.daidalos.nl<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 Keith L. Breinholt
Sent: maandag 2 november 2009 23:41
To: [email protected]
Subject: [MarkLogic Dev General] Can't post JPG files...

What is the correct way of receiving a 'POST'ed file?

With the following HTML form and post-any.xqy code pass/post file of most any 
type except JPG.

html xmlns="http://www.w3.org/1999/xhtml";>
    <body>
        <form name="test" action="post-any.xqy" method="post" 
enctype="multipart/form-data">
            <p>File to upload: <input type="file" name="upload" /></p>
            <p><input type="submit" value="Upload"/></p>
        </form>
    </body>
</html>

Contents of post-any.xqy

let $filename := xdmp:get-request-field-filename( "upload" )
let $type := xdmp:get-request-field-content-type( "upload" )
let $body :=
  if ( xdmp:get-request-method() eq "POST" or $type eq 
"application/x-www-form-urlencoded" )
  then xdmp:get-request-field("upload")
  else xdmp:get-request-body( xdmp:uri-format( $filename ) )
let $uri := concat( "/test/", $filename )
return xdmp:document-insert( $uri, $body )

What is the correct way of sending and receiving binary files?

Thanks,

Keith L. Breinholt
ICS Content & Media
[email protected]<mailto:[email protected]>
"Do what you can, with what you have, where you are." Theodore Roosevelt



NOTICE: This email message is for the sole use of the intended recipient(s) and 
may contain confidential and privileged information. Any unauthorized review, 
use, disclosure or distribution is prohibited. If you are not the intended 
recipient, please contact the sender by reply email and destroy all copies of 
the original message.




_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to