Possible bug with file upload control inside repeat

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

Possible bug with file upload control inside repeat

Alan Skorkin
Possible bug with file upload control inside repeat

Hi,

We've encountered a possible bug when using file upload controls inside repeats.

The scenario is the following:

 - you have a repeat which contains a file upload control in it
 - you put the repeat on the form
 - the repeat initially contains no rows (there is an insert button to insert rows)
 - you press the insert button which insert a row in the repeat, the row has a file upload
 - you may now browse to a file you want to upload

Unfortunately if you now try to submit the form the enctype='multipart/form-data' which should be present on the 'form'

element in the html (if you view source), is not there. Therefore the files can't get uploaded properly.

We are using type="xs:base64Binary" for our files so we expect a base64 string when we submit, but since the submission
encoding is not 'multipart/form-data' the uploaded file doesn't get read at all.

If the repeat, initially when the form first loads has at least one visible row with a file upload, or if there are other file upload controls

on the form then the enctype='multipart/form-data' is present and there is no problem.

I believe this is a bug with file uploads inside repeats.

Cheers,

Alan

---------------------------------------------------------------------
Alan Skorkin
Consultant
Object Consulting

[hidden email]
www.objectconsulting.com.au

consulting | development | training | support
Our Experience Makes The Difference
---------------------------------------------------------------------



--
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: Possible bug with file upload control inside repeat

Erik Bruchez
Administrator
Alan,

Is this with XForms Classic or NG?

Can you send a small reproducible case?

-Erik

Alan Skorkin wrote:

> Hi,
>
> We've encountered a possible bug when using file upload controls inside
> repeats.
>
> The scenario is the following:
>
>  - you have a repeat which contains a file upload control in it
>  - you put the repeat on the form
>  - the repeat initially contains no rows (there is an insert button to
> insert rows)
>  - you press the insert button which insert a row in the repeat, the row
> has a file upload
>  - you may now browse to a file you want to upload
>
> Unfortunately if you now try to submit the form the
> enctype='multipart/form-data' which should be present on the 'form'
>
> element in the html (if you view source), is not there. Therefore the
> files can't get uploaded properly.
>
> We are using type="xs:base64Binary" for our files so we expect a base64
> string when we submit, but since the submission
> encoding is not 'multipart/form-data' the uploaded file doesn't get read
> at all.
>
> If the repeat, initially when the form first loads has at least one
> visible row with a file upload, or if there are other file upload controls
>
> on the form then the enctype='multipart/form-data' is present and there
> is no problem.
>
> I believe this is a bug with file uploads inside repeats.
>
> Cheers,
>
> Alan
>
> ---------------------------------------------------------------------__
> _Alan Skorkin_
> Consultant
> Object Consulting
>
> [hidden email]
> ___www.objectconsulting.com.au_
>
> consulting | development | training | support
> Our Experience Makes The Difference
> ---------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
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: Possible bug with file upload control inside repeat

Zdeněk Hřib
Hello,

I have a similar problem, maybe they are related although we are using
"xs:anyURI". I would also like to make a possibility to upload files in my
Xform. User should be able to upload as much files as he wants. Therefore I
am using xforms:upload embeded in xforms:repeat.

I have na XML instance snippet:

...................
                        <attachments>
                            <attachment>
                                <uploadedFile filename="" mediatype=""
size=""/>
                            </attachment>
                        </attachments>
.......................


and in the page I have a code:

........

<xforms:bind
nodeset="instance('main-instance')/document//quest:attachments/quest:attachm
ent/quest:uploadedFile" type="xs:anyURI" />

.................

<xforms:repeat nodeset="quest:attachments/quest:attachment[position() &lt;
last()]" id="atachments-repeat" >
<p>
<xforms:upload ref="quest:uploadedFile" >
<xforms:filename ref="@filename"/>
<xforms:mediatype ref="@mediatype"/>
<xxforms:size ref="@size"/>
</xforms:upload>
<xforms:trigger>
<xforms:label>Remove file</xforms:label>
<xforms:action ev:event="DOMActivate">
<xforms:delete nodeset="." at="index('atachments-repeat')"/>
</xforms:action>
</xforms:trigger>
</p>
</xforms:repeat>

<xforms:trigger>
<xforms:label>Add file</xforms:label>
<xforms:action ev:event="DOMActivate">
<xforms:insert nodeset="quest:attachments/quest:attachment" at="last()"
position="before"/>
</xforms:action>
</xforms:trigger>

......

the problem is in the fact, that if I add an file and submit the form, in
the XML that goes into the pipeline as an submited instance there is a local
path to the file on my HDD in the <uploadedFile/> (like C:\something.txt
instead of the path to the temporary folder) and therefore the file from the
URI can not be transformed to base64 and also the attributes like mediatype
or size are not filled in.

for example:
<attachments>
<attachment>
<uploadedFile filename="" mediatype=""
size="">C:\ipconfig.txt</uploadedFile>
</attachment>
</attachments>

But everything works fine, if I do not try to hide the last "template"
element in the repeat so I use

......
<xforms:repeat nodeset="quest:attachments/quest:attachment"
id="atachments-repeat" >
.....

or if I hide it with RELEVANT bind
.........
<xforms:bind
nodeset="instance('main-instance')/document//quest:attachments/quest:attachm
ent[position() = last()]" relevant="instance('status')/sending = '1'" />
...............


in both cases I get a correct XML:

<attachments>
<attachment>
<uploadedFile filename="C:\ipconfig.txt" mediatype="text/plain"
size="132">file:/C:/Develop/Java/jakarta-tomcat-5.5.9/work/Catalina/localhos
t/exist/cocoon-files/cache-dir/upload_00000314.tmp</uploadedFile>
</attachment>
</attachments>

is this a feature or bug ?




--
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: Possible bug with file upload control inside repeat

Erik Bruchez
Administrator
I would assume a bug. We need to reproduce this, but I have entered the
bug already:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=305297&group_id=168&atid=350207

-Erik

Zdenek Hrib wrote:

> Hello,
>
> I have a similar problem, maybe they are related although we are using
> "xs:anyURI". I would also like to make a possibility to upload files in my
> Xform. User should be able to upload as much files as he wants. Therefore I
> am using xforms:upload embeded in xforms:repeat.
>
> I have na XML instance snippet:
>
> ...................
>                         <attachments>
>                             <attachment>
>                                 <uploadedFile filename="" mediatype=""
> size=""/>
>                             </attachment>
>                         </attachments>
> .......................
>
>
> and in the page I have a code:
>
> ........
>
> <xforms:bind
> nodeset="instance('main-instance')/document//quest:attachments/quest:attachm
> ent/quest:uploadedFile" type="xs:anyURI" />
>
> .................
>
> <xforms:repeat nodeset="quest:attachments/quest:attachment[position() &lt;
> last()]" id="atachments-repeat" >
> <p>
> <xforms:upload ref="quest:uploadedFile" >
> <xforms:filename ref="@filename"/>
> <xforms:mediatype ref="@mediatype"/>
> <xxforms:size ref="@size"/>
> </xforms:upload>
> <xforms:trigger>
> <xforms:label>Remove file</xforms:label>
> <xforms:action ev:event="DOMActivate">
> <xforms:delete nodeset="." at="index('atachments-repeat')"/>
> </xforms:action>
> </xforms:trigger>
> </p>
> </xforms:repeat>
>
> <xforms:trigger>
> <xforms:label>Add file</xforms:label>
> <xforms:action ev:event="DOMActivate">
> <xforms:insert nodeset="quest:attachments/quest:attachment" at="last()"
> position="before"/>
> </xforms:action>
> </xforms:trigger>
>
> ......
>
> the problem is in the fact, that if I add an file and submit the form, in
> the XML that goes into the pipeline as an submited instance there is a local
> path to the file on my HDD in the <uploadedFile/> (like C:\something.txt
> instead of the path to the temporary folder) and therefore the file from the
> URI can not be transformed to base64 and also the attributes like mediatype
> or size are not filled in.
>
> for example:
> <attachments>
> <attachment>
> <uploadedFile filename="" mediatype=""
> size="">C:\ipconfig.txt</uploadedFile>
> </attachment>
> </attachments>
>
> But everything works fine, if I do not try to hide the last "template"
> element in the repeat so I use
>
> ......
> <xforms:repeat nodeset="quest:attachments/quest:attachment"
> id="atachments-repeat" >
> .....
>
> or if I hide it with RELEVANT bind
> .........
> <xforms:bind
> nodeset="instance('main-instance')/document//quest:attachments/quest:attachm
> ent[position() = last()]" relevant="instance('status')/sending = '1'" />
> ...............
>
>
> in both cases I get a correct XML:
>
> <attachments>
> <attachment>
> <uploadedFile filename="C:\ipconfig.txt" mediatype="text/plain"
> size="132">file:/C:/Develop/Java/jakarta-tomcat-5.5.9/work/Catalina/localhos
> t/exist/cocoon-files/cache-dir/upload_00000314.tmp</uploadedFile>
> </attachment>
> </attachments>
>
> is this a feature or bug ?
>
>
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
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: Possible bug with file upload control inside repeat

Zdeněk Hřib
am I now supposed to do something to help you ?

----- Original Message -----
From: "Erik Bruchez" <[hidden email]>
To: <[hidden email]>
Sent: Wednesday, May 17, 2006 3:07 PM
Subject: Re: [ops-users] Possible bug with file upload control inside repeat


> I would assume a bug. We need to reproduce this, but I have entered the
> bug already:
>
>
http://forge.objectweb.org/tracker/index.php?func=detail&aid=305297&group_id=168&atid=350207
>
> -Erik
>
> Zdenek Hrib wrote:
> > Hello,
> >
> > I have a similar problem, maybe they are related although we are using
> > "xs:anyURI". I would also like to make a possibility to upload files in
my
> > Xform. User should be able to upload as much files as he wants.
Therefore I

> > am using xforms:upload embeded in xforms:repeat.
> >
> > I have na XML instance snippet:
> >
> > ...................
> >                         <attachments>
> >                             <attachment>
> >                                 <uploadedFile filename="" mediatype=""
> > size=""/>
> >                             </attachment>
> >                         </attachments>
> > .......................
> >
> >
> > and in the page I have a code:
> >
> > ........
> >
> > <xforms:bind
> >
nodeset="instance('main-instance')/document//quest:attachments/quest:attachm
> > ent/quest:uploadedFile" type="xs:anyURI" />
> >
> > .................
> >
> > <xforms:repeat nodeset="quest:attachments/quest:attachment[position()
&lt;

> > last()]" id="atachments-repeat" >
> > <p>
> > <xforms:upload ref="quest:uploadedFile" >
> > <xforms:filename ref="@filename"/>
> > <xforms:mediatype ref="@mediatype"/>
> > <xxforms:size ref="@size"/>
> > </xforms:upload>
> > <xforms:trigger>
> > <xforms:label>Remove file</xforms:label>
> > <xforms:action ev:event="DOMActivate">
> > <xforms:delete nodeset="." at="index('atachments-repeat')"/>
> > </xforms:action>
> > </xforms:trigger>
> > </p>
> > </xforms:repeat>
> >
> > <xforms:trigger>
> > <xforms:label>Add file</xforms:label>
> > <xforms:action ev:event="DOMActivate">
> > <xforms:insert nodeset="quest:attachments/quest:attachment" at="last()"
> > position="before"/>
> > </xforms:action>
> > </xforms:trigger>
> >
> > ......
> >
> > the problem is in the fact, that if I add an file and submit the form,
in
> > the XML that goes into the pipeline as an submited instance there is a
local
> > path to the file on my HDD in the <uploadedFile/> (like C:\something.txt
> > instead of the path to the temporary folder) and therefore the file from
the
> > URI can not be transformed to base64 and also the attributes like
mediatype

> > or size are not filled in.
> >
> > for example:
> > <attachments>
> > <attachment>
> > <uploadedFile filename="" mediatype=""
> > size="">C:\ipconfig.txt</uploadedFile>
> > </attachment>
> > </attachments>
> >
> > But everything works fine, if I do not try to hide the last "template"
> > element in the repeat so I use
> >
> > ......
> > <xforms:repeat nodeset="quest:attachments/quest:attachment"
> > id="atachments-repeat" >
> > .....
> >
> > or if I hide it with RELEVANT bind
> > .........
> > <xforms:bind
> >
nodeset="instance('main-instance')/document//quest:attachments/quest:attachm

> > ent[position() = last()]" relevant="instance('status')/sending = '1'" />
> > ...............
> >
> >
> > in both cases I get a correct XML:
> >
> > <attachments>
> > <attachment>
> > <uploadedFile filename="C:\ipconfig.txt" mediatype="text/plain"
> >
size="132">file:/C:/Develop/Java/jakarta-tomcat-5.5.9/work/Catalina/localhos

> > t/exist/cocoon-files/cache-dir/upload_00000314.tmp</uploadedFile>
> > </attachment>
> > </attachments>
> >
> > is this a feature or bug ?
> >
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> >
> > --
> > 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
>
>
> --
> Orbeon - XForms Everywhere:
> http://www.orbeon.com/blog/
>
>

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


>
> --
> 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
>




--
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: Possible bug with file upload control inside repeat

Erik Bruchez
Administrator
I believe the issue has been described well enough that we can fix the bug.

Best,

-Erik

Zdenek Hrib wrote:

> am I now supposed to do something to help you ?
>
> ----- Original Message -----
> From: "Erik Bruchez" <[hidden email]>
> To: <[hidden email]>
> Sent: Wednesday, May 17, 2006 3:07 PM
> Subject: Re: [ops-users] Possible bug with file upload control inside repeat
>
>
>> I would assume a bug. We need to reproduce this, but I have entered the
>> bug already:
>>
>>
> http://forge.objectweb.org/tracker/index.php?func=detail&aid=305297&group_id=168&atid=350207
>> -Erik
>>
>> Zdenek Hrib wrote:
>>> Hello,
>>>
>>> I have a similar problem, maybe they are related although we are using
>>> "xs:anyURI". I would also like to make a possibility to upload files in
> my
>>> Xform. User should be able to upload as much files as he wants.
> Therefore I
>>> am using xforms:upload embeded in xforms:repeat.
>>>
>>> I have na XML instance snippet:
>>>
>>> ...................
>>>                         <attachments>
>>>                             <attachment>
>>>                                 <uploadedFile filename="" mediatype=""
>>> size=""/>
>>>                             </attachment>
>>>                         </attachments>
>>> .......................
>>>
>>>
>>> and in the page I have a code:
>>>
>>> ........
>>>
>>> <xforms:bind
>>>
> nodeset="instance('main-instance')/document//quest:attachments/quest:attachm
>>> ent/quest:uploadedFile" type="xs:anyURI" />
>>>
>>> .................
>>>
>>> <xforms:repeat nodeset="quest:attachments/quest:attachment[position()
> &lt;
>>> last()]" id="atachments-repeat" >
>>> <p>
>>> <xforms:upload ref="quest:uploadedFile" >
>>> <xforms:filename ref="@filename"/>
>>> <xforms:mediatype ref="@mediatype"/>
>>> <xxforms:size ref="@size"/>
>>> </xforms:upload>
>>> <xforms:trigger>
>>> <xforms:label>Remove file</xforms:label>
>>> <xforms:action ev:event="DOMActivate">
>>> <xforms:delete nodeset="." at="index('atachments-repeat')"/>
>>> </xforms:action>
>>> </xforms:trigger>
>>> </p>
>>> </xforms:repeat>
>>>
>>> <xforms:trigger>
>>> <xforms:label>Add file</xforms:label>
>>> <xforms:action ev:event="DOMActivate">
>>> <xforms:insert nodeset="quest:attachments/quest:attachment" at="last()"
>>> position="before"/>
>>> </xforms:action>
>>> </xforms:trigger>
>>>
>>> ......
>>>
>>> the problem is in the fact, that if I add an file and submit the form,
> in
>>> the XML that goes into the pipeline as an submited instance there is a
> local
>>> path to the file on my HDD in the <uploadedFile/> (like C:\something.txt
>>> instead of the path to the temporary folder) and therefore the file from
> the
>>> URI can not be transformed to base64 and also the attributes like
> mediatype
>>> or size are not filled in.
>>>
>>> for example:
>>> <attachments>
>>> <attachment>
>>> <uploadedFile filename="" mediatype=""
>>> size="">C:\ipconfig.txt</uploadedFile>
>>> </attachment>
>>> </attachments>
>>>
>>> But everything works fine, if I do not try to hide the last "template"
>>> element in the repeat so I use
>>>
>>> ......
>>> <xforms:repeat nodeset="quest:attachments/quest:attachment"
>>> id="atachments-repeat" >
>>> .....
>>>
>>> or if I hide it with RELEVANT bind
>>> .........
>>> <xforms:bind
>>>
> nodeset="instance('main-instance')/document//quest:attachments/quest:attachm
>>> ent[position() = last()]" relevant="instance('status')/sending = '1'" />
>>> ...............
>>>
>>>
>>> in both cases I get a correct XML:
>>>
>>> <attachments>
>>> <attachment>
>>> <uploadedFile filename="C:\ipconfig.txt" mediatype="text/plain"
>>>
> size="132">file:/C:/Develop/Java/jakarta-tomcat-5.5.9/work/Catalina/localhos
>>> t/exist/cocoon-files/cache-dir/upload_00000314.tmp</uploadedFile>
>>> </attachment>
>>> </attachments>
>>>
>>> is this a feature or bug ?
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>> --
>>> 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
>>
>> --
>> Orbeon - XForms Everywhere:
>> http://www.orbeon.com/blog/
>>
>>
>
>
> ----------------------------------------------------------------------------
> ----
>
>
>> --
>> 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
>>
>
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
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