Code : Upload file problem, second time!

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

Code : Upload file problem, second time!

Wang Yan
Hi, I've tried with this code below in order to uplaod a file to a specific location of the local disk, however I can create the file, but there is no correct data inside. It has 0 Ko. Can you help me ? Thanks you !

Here is the main parts of my code :

Xforms:
<xforms:group ref="instance('file-instance2')/files/file">
         
                       <xforms:upload ref=".">
                                  <xforms:filename ref="@filename"/>
                                   ;  <xforms:mediatype ref="@mediatype"/>
                                    <xxforms:size ref="@size"/>
                          </xforms:upload>

                <xforms:trigger>
                            <xforms:label>Upload</xforms:label>
                                <xforms:action ev:event="DOMActivate">
         &n bsp;                      <xforms:setvalue ref="instance('file-instance2')//action">upload</xforms:setvalue>
                                 <xforms:send submission="load-submission"/>
                                   </xforms:action>
                   </xforms:trigger>
    </xforms:group>

<xforms:submission id="load-submission" ref="instance('file-instance2')" method="post" replace="all" action="/is/evaluation/documents/" ;/>

Action in XPL :

<p:processor name="oxf:xslt" xmlns:p="http://www.orbeon.com/oxf/pipeline">
        <p:input name="data" href="#instance"/>
        <p:input name="config">
            <config xsl:version="2.0">
                <url>
                    <xsl:value-of select="/form/files/file/@filename"/>
                </url>
                <content-type>
                     <xsl:value-of select="/form/files/file/@mediatype"/>
                </content-type>
                <force-content-type>true</force-content-type>
            </config>
        </p:input>
        <p:output name="data" id="url-config"/>
    </p:processor>
    <p:processor name="oxf:url-generator" xmlns:p="http://www.orbeon.com/oxf/pipeline">
        <p:input name="config" href="#url-config"/>
        <p:output name="data" id="i mage-data"/>
    </p:processor>
   
   
    <p:processor name="oxf:xslt" xmlns:p="http://www.orbeon.com/oxf/pipeline">
        <p:input name="data" href="#instance"/>
        <p:input name="config">
            <config xsl:version="2.0">
                <file>
                    <xsl:value-of select="/form/files/file/@filename"/>
                </file>
                <directory >
                    C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\CGCReloaded\WEB-INF\resources\is\evaluation\documents
                </directory>
                <content-type>
                    <xsl:value-of select="/form/files/file/@mediatype"/>
                </content-type>
                </config>
        </p:input>
        <p:output name="data" id="url-config2"/>
    &l t;/p:processor>
    <p:processor name="oxf:file-serializer">
        <p:input name="config" href="#url-config2"/>
        <p:input name="data" href="#image-data"/>
    </p:processor>


Result : I can got the file on the right place, but the file has any data, it has 0 Ko of size !

-----------------------------------------------------
Romandie Annonces : http://annonces.romandie.com
Petites annonces 100% gratuites entre romands
-----------------------------------------------------




--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Code : Upload file problem, second time!

Erik Bruchez
Administrator
Yan,

We realized that the doc on the web site was out of date: we were still
documenting the old, legacy File serializer, instead of the "new"
(probably 1-2 year-old now!) File serializer. See the new doc here:

   http://www.orbeon.com/ops/doc/processors-serializers#file-serializer

Does that help?

If not, can you add debug attributes in your pipeline and see anything
interesting?

-Erik

Wang Yan wrote:

> Hi, I've tried with this code below in order to uplaod a file to a
> specific location of the local disk, however I can create the file, but
> there is no correct data inside. It has 0 Ko. Can you help me ? Thanks you !
>
> Here is the main parts of my code :
>
> Xforms:
> <xforms:group ref="instance('file-instance2')/files/file">
>          
>                        <xforms:upload ref=".">
>                                   <xforms:filename ref="@filename"/>
>                                    ;  <xforms:mediatype ref="@mediatype"/>
>                                     <xxforms:size ref="@size"/>
>                           </xforms:upload>
>
>                 <xforms:trigger>
>                             <xforms:label>Upload</xforms:label>
>                                 <xforms:action ev:event="DOMActivate">
>          &n bsp;                      <xforms:setvalue
> ref="instance('file-instance2')//action">upload</xforms:setvalue>
>                                  <xforms:send submission="load-submission"/>
>                                    </xforms:action>
>                    </xforms:trigger>
>     </xforms:group>
>
> <xforms:submission id="load-submission" ref="instance('file-instance2')"
> method="post" replace="all" action="/is/evaluation/documents/" ;/>
>
> Action in XPL :
>
> <p:processor name="oxf:xslt" xmlns:p="http://www.orbeon.com/oxf/pipeline">
>         <p:input name="data" href="#instance"/>
>         <p:input name="config">
>             <config xsl:version="2.0">
>                 <url>
>                     <xsl:value-of select="/form/files/file/@filename"/>
>                 </url>
>                 <content-type>
>                      <xsl:value-of select="/form/files/file/@mediatype"/>
>                 </content-type>
>                 <force-content-type>true</force-content-type>
>             </config>
>         </p:input>
>         <p:output name="data" id="url-config"/>
>     </p:processor>
>     <p:processor name="oxf:url-generator"
> xmlns:p="http://www.orbeon.com/oxf/pipeline">
>         <p:input name="config" href="#url-config"/>
>         <p:output name="data" id="i mage-data"/>
>     </p:processor>
>    
>    
>     <p:processor name="oxf:xslt"
> xmlns:p="http://www.orbeon.com/oxf/pipeline">
>         <p:input name="data" href="#instance"/>
>         <p:input name="config">
>             <config xsl:version="2.0">
>                 <file>
>                     <xsl:value-of select="/form/files/file/@filename"/>
>                 </file>
>                 <directory >
>                     C:\Program Files\Apache Software Foundation\Tomcat
> 5.5\webapps\CGCReloaded\WEB-INF\resources\is\evaluation\documents
>                 </directory>
>                 <content-type>
>                     <xsl:value-of select="/form/files/file/@mediatype"/>
>                 </content-type>
>                 </config>
>         </p:input>
>         <p:output name="data" id="url-config2"/>
>     &l t;/p:processor>
>     <p:processor name="oxf:file-serializer">
>         <p:input name="config" href="#url-config2"/>
>         <p:input name="data" href="#image-data"/>
>     </p:processor>
>
>
> Result : I can got the file on the right place, but the file has any
> data, it has 0 Ko of size !
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Code : Upload file problem, second time!

Wang Yan
Hi, first at all thank you Erik for the link you gave me.

But I've still a question about upload problem!

I've implemented something that works by taking example in the documentation. My code is :

<p:processor name="oxf:xslt" xmlns:p="http://www.orbeon.com/oxf/pipeline">
           <p:input name="data" href="#instance"/>
            <p:input name="config">
                            <config xsl:version="2.0">
                                <url>
                &nbs p;                   <xsl:value-of select="/form/files/file/@filename"/>
                                </url>
                                <content-type>
                                    <xsl:value-of select="/form/files/file/@mediatype"/>
                                </content-type>
          &nb sp;                 </config>
                        </p:input>
                        <p:output name="data" id="url-config"/>
                    </p:processor>
                    <p:processor name="oxf:url-generator">
                        <p:input name="config" href="#url-config"/>
                     & nbsp;  <p:output name="data" id="url-config1"/>
                    </p:processor>
                    <p:processor name="oxf:xslt" xmlns:p="http://www.orbeon.com/oxf/pipeline">
                        <p:input name="data" href="#instance"/>
                        <p:input name="config">
                            <config xsl:version="2.0">
            & nbsp;                   <file>
                                    <xsl:value-of select="/form/files/file/@filename"/>
                                </file>
                                <directory>
                    C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\CGCReloaded\WEB-INF\resources\is\evaluation\documents\temp
             &n bsp;  </directory>
                            </config>
                        </p:input>
                        <p:output name="data" id="url-config2"/>
                    </p:processor>
                    <p:processor name="oxf:file-serializer">
                        <p:input name="config" href="#url-config2"/>
 &nbs p;                      <p:input name="data" href="#url-config1"/>
                    </p:processor>

It works. I can choose a file and generate a copy of this file in the directory in which I would like to put.

However, when I'm trying to take a file in a diretory outside of ops, I got an error which told me "cannot found /ops/.../file.jpg with loader" !

Do you have any idea about that ?

thanks !


En réponse à Erik Bruchez <[hidden email]> :
Yan,

We realized that the doc on the web site was out of date: we were still
documenting the old, legacy File serializer, instead of the "new"
(probably 1-2 year-old now!) File serializer . See the new doc here:

http://www.orbeon.com/ops/doc/processors-serializers#file-serializer

Does that help?

If not, can you add debug attributes in your pipeline and see anything
interesting?

-Erik

Wang Yan wrote:

> Hi, I've tried with this code below in order to uplaod a file to a
> specific location of the local disk, however I can create the file, but
> there is no correct data inside. It has 0 Ko. Can you help me ? Thanks you !
>
> Here is the main parts of my code :
>
> Xforms:
> <xforms:group ref="instance('file-instance2')/files/file">
>
> <xforms:upload ref=".">
> <xforms:filename ref="@filename"/>
> ; <xforms:mediatype ref="@ mediatype"/>
> <xxforms:size ref="@size"/>
> </xforms:upload>
>
> <xforms:trigger>
> <xforms:label>Upload</xforms:label>
> <xforms:action ev:event="DOMActivate">
> &n bsp; <xforms:setvalue
> ref="instance('file-instance2')//action">upload</xforms:setvalue>
> <xforms:send submission="load-submission"/>
> </xforms:action>
> </xforms:trigger>
> </xforms:group>
>
> <xforms:submission id="load-submission" ref="instance('file-instance2')"
> metho d="post" replace="all" action="/is/evaluation/documents/" ;/>
>
> Action in XPL :
>
> <p:processor name="oxf:xslt" xmlns:p="http://www.orbeon.com/oxf/pipeline">
> <p:input name="data" href="#instance"/>
> <p:input name="config">
> <config xsl:version="2.0">
> <url>
> <xsl:value-of select="/form/files/file/@filename"/>
> </url>
> <content-type>
> <xsl:value-of select="/form/files/file/@mediatype"/>
> </content-type>
> <force-content-type>true</force-content-type>
> </config>
> &l t;/p:input>
> <p:output name="data" id="url-config"/>
> </p:processor>
> <p:processor name="oxf:url-generator"
> xmlns:p="http://www.orbeon.com/oxf/pipeline">
> <p:input name="config" href="#url-config"/>
> <p:output name="data" id="i mage-data"/>
> </p:processor>
>
>
> <p:processor name="oxf:xslt"
> xmlns:p="http://www.orbeon.com/oxf/pipeline">
> <p:input name="data" href="#instance"/>
> <p:input name="config">
> <config xsl:version="2.0">
> <file>
> <xsl:value-of select="/form/files/file/@filename"/> ;
> </file>
> <directory >
> C:\Program Files\Apache Software Foundation\Tomcat
> 5.5\webapps\CGCReloaded\WEB-INF\resources\is\evaluation\documents
> </directory>
> <content-type>
> <xsl:value-of select="/form/files/file/@mediatype"/>
> </content-type>
> </config>
> </p:input>
> <p:output name="data" id="url-config2"/>
> &l t;/p:processor>
> <p:processor name="oxf:file-serializer">
> <p:input name="config" href="#url-config2"/>
> <p:input name="data" href="#image-data"/>
> </p:processor>
>
>
> Result : I can got the file on the right place, but the file has any
> data, it has 0 Ko of size !

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



message-footer.txt

--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws


-----------------------------------------------------
Romandie Annonces : http://annonces.romandie.com
Petites annonces 100% gratuites entre romands
-----------------------------------------------------




--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Code : Upload file problem, second time!

Erik Bruchez
Administrator
Yan,

This seems to suggest that there is some code somewhere that tries to
access a file with the "oxf:" protocol but doesn't find it. In your
case, the location is probably "oxf:/ops/.../file.jpg", with the "..." I
assume being some location you don't want to detail. Valid questions
would be:

o What code tries to access that file
o Is file.jpg supposed to be at that location anyway?

-Erik

Wang Yan wrote:

> Hi, first at all thank you Erik for the link you gave me.
>
> But I've still a question about upload problem!
>
> I've implemented something that works by taking example in the
> documentation. My code is :
>
> <p:processor name="oxf:xslt" xmlns:p="http://www.orbeon.com/oxf/pipeline">
>            <p:input name="data" href="#instance"/>
>             <p:input name="config">
>                             <config xsl:version="2.0">
>                                 <url>
>                 &nbs p;                   <xsl:value-of
> select="/form/files/file/@filename"/>
>                                 </url>
>                                 <content-type>
>                                     <xsl:value-of
> select="/form/files/file/@mediatype"/>
>                                 </content-type>
>           &nb sp;                 </config>
>                         </p:input>
>                         <p:output name="data" id="url-config"/>
>                     </p:processor>
>                     <p:processor name="oxf:url-generator">
>                         <p:input name="config" href="#url-config"/>
>                      & nbsp;  <p:output name="data" id="url-config1"/>
>                     </p:processor>
>                     <p:processor name="oxf:xslt"
> xmlns:p="http://www.orbeon.com/oxf/pipeline">
>                         <p:input name="data" href="#instance"/>
>                         <p:input name="config">
>                             <config xsl:version="2.0">
>             & nbsp;                   <file>
>                                     <xsl:value-of
> select="/form/files/file/@filename"/>
>                                 </file>
>                                 <directory>
>                     C:\Program Files\Apache Software Foundation\Tomcat
> 5.5\webapps\CGCReloaded\WEB-INF\resources\is\evaluation\documents\temp
>              &n bsp;  </directory>
>                             </config>
>                         </p:input>
>                         <p:output name="data" id="url-config2"/>
>                     </p:processor>
>                     <p:processor name="oxf:file-serializer">
>                         <p:input name="config" href="#url-config2"/>
>  &nbs p;                      <p:input name="data" href="#url-config1"/>
>                     </p:processor>
>
> It works. I can choose a file and generate a copy of this file in the
> directory in which I would like to put.
>
> However, when I'm trying to take a file in a diretory outside of ops, I
> got an error which told me "cannot found /ops/.../file.jpg with loader" !
>
> Do you have any idea about that ?
>
> thanks !
>
>
> En réponse à Erik Bruchez <[hidden email]> :
>> Yan,
>>
>> We realized that the doc on the web site was out of date: we were still
>> documenting the old, legacy File serializer, instead of the "new"
>> (probably 1-2 year-old now!) File serializer . See the new doc here:
>>
>> http://www.orbeon.com/ops/doc/processors-serializers#file-serializer
>>
>> Does that help?
>>
>> If not, can you add debug attributes in your pipeline and see anything
>> interesting?
>>
>> -Erik
>>
>> Wang Yan wrote:
>> > Hi, I've tried with this code below in order to uplaod a file to a
>> > specific location of the local disk, however I can create the file, but
>> > there is no correct data inside. It has 0 Ko. Can you help me ?
>> Thanks you !
>> >
>> > Here is the main parts of my code :
>> >
>> > Xforms:
>> > <xforms:group ref="instance('file-instance2')/files/file">
>> >
>> > <xforms:upload ref=".">
>> > <xforms:filename ref="@filename"/>
>> > ; <xforms:mediatype ref="@ mediatype"/>
>> > <xxforms:size ref="@size"/>
>> > </xforms:upload>
>> >
>> > <xforms:trigger>
>> > <xforms:label>Upload</xforms:label>
>> > <xforms:action ev:event="DOMActivate">
>> > &n bsp; <xforms:setvalue
>> > ref="instance('file-instance2')//action">upload</xforms:setvalue>
>> > <xforms:send submission="load-submission"/>
>> > </xforms:action>
>> > </xforms:trigger>
>> > </xforms:group>
>> >
>> > <xforms:submission id="load-submission"
>> ref="instance('file-instance2')"
>> > metho d="post" replace="all" action="/is/evaluation/documents/" ;/>
>> >
>> > Action in XPL :
>> >
>> > <p:processor name="oxf:xslt"
>> xmlns:p="http://www.orbeon.com/oxf/pipeline">
>> > <p:input name="data" href="#instance"/>
>> > <p:input name="config">
>> > <config xsl:version="2.0">
>> > <url>
>> > <xsl:value-of select="/form/files/file/@filename"/>
>> > </url>
>> > <content-type>
>> > <xsl:value-of select="/form/files/file/@mediatype"/>
>> > </content-type>
>> > <force-content-type>true</force-content-type>
>> > </config>
>> > &l t;/p:input>
>> > <p:output name="data" id="url-config"/>
>> > </p:processor>
>> > <p:processor name="oxf:url-generator"
>> > xmlns:p="http://www.orbeon.com/oxf/pipeline">
>> > <p:input name="config" href="#url-config"/>
>> > <p:output name="data" id="i mage-data"/>
>> > </p:processor>
>> >
>> >
>> > <p:processor name="oxf:xslt"
>> > xmlns:p="http://www.orbeon.com/oxf/pipeline">
>> > <p:input name="data" href="#instance"/>
>> > <p:input name="config">
>> > <config xsl:version="2.0">
>> > <file>
>> > <xsl:value-of select="/form/files/file/@filename"/> ;
>> > </file>
>> > <directory >
>> > C:\Program Files\Apache Software Foundation\Tomcat
>> > 5.5\webapps\CGCReloaded\WEB-INF\resources\is\evaluation\documents
>> > </directory>
>> > <content-type>
>> > <xsl:value-of select="/form/files/file/@mediatype"/>
>> > </content-type>
>> > </config>
>> > </p:input>
>> > <p:output name="data" id="url-config2"/>
>> > &l t;/p:processor>
>> > <p:processor name="oxf:file-serializer">
>> > <p:input name="config" href="#url-config2"/>
>> > <p:input name="data" href="#image-data"/>
>> > </p:processor>
>> >
>> >
>> > Result : I can got the file on the right place, but the file has any
>> > data, it has 0 Ko of size !
>>
>> --
>> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>> http://www.orbeon.com/
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws