I am using IE or Firefox on 64-bit Vista, server is on the same box, and what I 
see in the JPG file after insert is the URL of the file.

  Like:  http://localhost:8033/file/put?/content/test/logo.jpg

I double checked the space; it is there. (Must have been lost in the email 
client.)

Since we are doing a post here we effectively only have 

  let $body := xdmp:get-request-field("upload")

on the receiving end.

Any other ideas?

Keith L. Breinholt
ICS Content & Media
[email protected]

________________________________________________________________________________________
Date: Tue, 03 Nov 2009 01:12:13 +0000
From: Wayne Feick <[email protected]>
Subject: Re: [MarkLogic Dev General] Can't post JPG files...

Here's the important bits of the HTML form from one of our apps, which
looks to be the same as yours except for the xmlns="" bit.

        <form name="test"
              action="upload.xqy"
              method="post"
              enctype="multipart/form-data"
              xmlns="">
          <input name="docFile" type="file" 
onchange="javascript:preview(this)"/>
          <input type="submit" value="Upload"/>
        </form>

Here is how it gets inserted into the database, which again looks very
much like what you're doing.

        xdmp:document-insert(
          $furi,
          xdmp:get-request-field("docFile"),
          $perms)

In the html you provided, I don't see a space before method="post" but
I'm assuming that's just a copy/paste error.

What behavior are you seeing?

Does it work if you simplify the "$body := ..." line down to just
calling xdmp:get-request-field()?

Wayne.


On Mon, 2009-11-02 at 14:40 -0800, Keith L. Breinholt wrote:
> 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>Fileto 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 $typeeq
> "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]
> 
> "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.
> 
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://xqzone.marklogic.com/pipermail/general/attachments/20091103/f9e068b1/attachment.html

------------------------------

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


End of General Digest, Vol 65, Issue 4
**************************************


 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