File upload control

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

File upload control

Robin Abbi
Dear List,

I have looked at the examples on the orbeon.com website to see how to do a
file upload.

The simple example:

http://www.orbeon.com/ops/xforms-sandbox/sample/upload-replace-instance

results in this content received by my (external) server:

<?xml version="1.0" encoding="UTF-8"?><file
xmlns:f="http://orbeon.org/oxf/xml/formatting"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:widget="http://orbeon.org/oxf/xml/widget"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" filename="test1.csv"
mediatype="text/csv"
size="1062">file:/home/robin/Desktop/apache-tomcat-5.5.20/temp/xforms_upload_27124.tmp</file>

The crucial point being, I get the name of the file as from the Orbeon
cache, not  the file content.

The running code is exactly that from the Orbeon web site, except that I
changed the action attribute. The code is cut and pasted below for
convenience.

What could I be doing wrong? Anything to do with base64Binary?

The more complicated example involves xpl and processors. But I'm hoping
there is some way of uploading a file using just plain vanilla xforms
controls and constructs.

Many Thanks,

Robin





The running code is

    Copyright (C) 2006 Orbeon, Inc.

    This program is free software; you can redistribute it and/or modify
it under the terms of the
    GNU Lesser General Public License as published by the Free Software
Foundation; either version
    2.1 of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY;
    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
    See the GNU Lesser General Public License for more details.

    The full text of the license is available at
http://www.gnu.org/copyleft/lesser.html
-->
<xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:f="http://orbeon.org/oxf/xml/formatting"
    xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
    xmlns:widget="http://orbeon.org/oxf/xml/widget"
    xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xhtml:head>
        <xhtml:title>XForms Upload with replace="instance"</xhtml:title>
        <xforms:model xmlns:xforms="http://www.w3.org/2002/xforms">
            <xforms:instance id="instance">
                <file filename="" mediatype="" size=""/>
            </xforms:instance>
            <xforms:submission
action="http://www.scdi.org/~avernet/try/post.php"
method="post" replace="instance" id="submission"/>
        </xforms:model>
        <xhtml:style type="text/css">
        </xhtml:style>
    </xhtml:head>
    <xhtml:body>
        <xforms:upload ref="/file">
            <xforms:filename ref="@filename"/>
            <xforms:mediatype ref="@mediatype"/>
            <xxforms:size ref="@size"/>
        </xforms:upload>
        <xforms:trigger>
            <xforms:label>Upload</xforms:label>
            <xforms:send submission="submission" ev:event="DOMActivate"/>
        </xforms:trigger>
    </xhtml:body>
</xhtml:html>





--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: File upload control

Alessandro Vernet
Administrator
Robin,

On Tue, Aug 19, 2008 at 10:10 AM, Robin Abbi <[hidden email]> wrote:
> The crucial point being, I get the name of the file as from the Orbeon
> cache, not  the file content.
>
> The running code is exactly that from the Orbeon web site, except that I
> changed the action attribute. The code is cut and pasted below for
> convenience.
>
> What could I be doing wrong? Anything to do with base64Binary?

Exactly: what you have there now is the URI of a temporary file, which
I assume you can't access in your other application if it runs from
another server. So you want to tell the XForms engine to put the file
in base64 in the instance. You do this with an <xforms:bind
nodeset="points to your node" type="xs:base64Binary"/>. You can find
more about this on:

http://www.orbeon.com/ops/doc/reference-xforms-ng#xforms-upload

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: File upload control

Robin Abbi
Alex,

Many thanks. Works beautifully.

Best wishes,

Robin


> Exactly: what you have there now is the URI of a temporary file, which
> I assume you can't access in your other application if it runs from
> another server. So you want to tell the XForms engine to put the file
> in base64 in the instance. You do this with an <xforms:bind
> nodeset="points to your node" type="xs:base64Binary"/>. You can find
> more about this on:
>
> http://www.orbeon.com/ops/doc/reference-xforms-ng#xforms-upload
>
> Alex
> --
> Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
> Orbeon's Blog: http://www.orbeon.com/blog/
> Personal Blog: http://avernet.blogspot.com/
> Twitter - http://twitter.com/avernet
>



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws