file upload filename

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

file upload filename

idwright
Hi,

I'm trying to upload a file and I'm having difficultly in getting the
file name correct
I do this successfully elsewhere so I'm puzzled as to why this isn't
working.

The difference with the working instance is that when it works I'm
uploading one file from the form so using the instance directly
When it doesn't working there are multiple uploads and I'm copying each
upload element into a different instance before submitting it.
As far as I can see the submitted XML is the same.

Any help gratefully received!
Thanks,
Ian

The submission is:
<xforms:submission id="sub-post-upload" method="form-data-post"
         
resource="{instance('ins-study-entry')/atom:link[@rel='http://www.cggh.org/2010/chassis/terms/curatedMedia']/@href}"
         ref="instance('ins-upload')" replace="instance"
instance="ins-upload-result-entry">

<xforms:header>
<xforms:name>Accept</xforms:name>
<xforms:value>application/atom+xml</xforms:value>
</xforms:header>

<!-- clear out upload -->
<!--
<xforms:insert ev:event="xforms-submit-done"
nodeset="instance('ins-upload')"
             origin="instance('ins-upload-empty')" />
   -->

<!-- TODO error handling -->
<xforms:message ev:event="xforms-submit-error" level="modal">
             An error occurred (
<xforms:output value="event('error-type')" />
             ) while posting an upload.
</xforms:message>

</xforms:submission>

I'm posting the following instance:

<upload scheme="http://www.cggh.org/2010/chassis/scheme/FileTypes"
term="http://www.cggh.org/2010/chassis/terms/DataFile" label=""
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:manta="http://www.cggh.org/2010/chassis/manta/xmlns"
xmlns:atombeat="http://purl.org/atombeat/xmlns"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:f="http://orbeon.org/oxf/xml/formatting"
xmlns:xforms="http://www.w3.org/2002/xforms"><summary/><category>scheme="http://www.cggh.org/2010/chassis/scheme/FileTypes";
term="http://www.cggh.org/2010/chassis/terms/DataFile";
label="";</category><media xsi:type="xs:anyURI"
filename="pharma-ssq-check" mediatype="application/octet-stream"
size="2598">file:/C:/Users/iwright/AppData/Local/Temp/xforms_upload_8487334723859706788.tmp</media></upload>

which is created by:

<xforms:action xxforms:iterate="instance('ins-uploads')//upload">
<xxforms:variable name="upload" select="."/>
<xxforms:variable name="file-uri" select="media/text()" />

<!--
                          All this is to preserve the namespace
declarations on the upload element
                           -->
<xforms:insert nodeset="instance('ins-upload')/*"
                             origin="$upload/*" />

<xforms:delete nodeset="instance('ins-upload')/*[3]" />
<xforms:delete nodeset="instance('ins-upload')/*[2]" />
<xforms:delete nodeset="instance('ins-upload')/*[1]" />

<xforms:setvalue ref="instance('ins-upload')//category"
value="concat('scheme=&quot;http://www.cggh.org/2010/chassis/scheme/FileTypes&quot;; 
term=&quot;',$upload/@term,'&quot;;
label=&quot;',$upload/@label,'&quot;;')"/>
<xforms:setvalue ref="instance('ins-upload')/@term" value="$upload/@term" />
<xforms:setvalue ref="instance('ins-upload')/@label"
value="$upload/@label" />
<xforms:setvalue ref="instance('ins-upload')/@filename"
value="$upload/media/@filename" />
<xforms:send submission="sub-post-upload"/>
</xforms:action>

from:
<uploads
target="http://localhost:8080/repository/service/content/media/curated/YBZYR"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:manta="http://www.cggh.org/2010/chassis/manta/xmlns"
xmlns:atombeat="http://purl.org/atombeat/xmlns"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:f="http://orbeon.org/oxf/xml/formatting"
xmlns:xforms="http://www.w3.org/2002/xforms"><upload
scheme="http://www.cggh.org/2010/chassis/scheme/FileTypes"
term="http://www.cggh.org/2010/chassis/terms/DataFile"
label=""><summary/><category/><media xsi:type="xs:anyURI"
filename="pharma-ssq-check" mediatype="application/octet-stream"
size="2598">file:/C:/Users/iwright/AppData/Local/Temp/xforms_upload_8487334723859706788.tmp</media></upload></uploads>

which gives in the log
POST /repository/service/content/media/curated/YBZYR HTTP/1.1[\r][\n]"
Accept: application/atom+xml[\r][\n]"
Cookie: JSESSIONID=0EC9046AA06E4F9628E7139E3E3187C6[\r][\n]"
Content-Type: multipart/form-data;
boundary=PLQFpiOkWB-IlgD6F8M-ynoOQoo8gwg3JfZ_G[\r][\n]"
User-Agent: Jakarta Commons-HttpClient/3.1-rc1[\r][\n]"
Host: localhost:8080[\r][\n]"
Content-Length: 3326[\r][\n]"
[\r][\n]"
--PLQFpiOkWB-IlgD6F8M-ynoOQoo8gwg3JfZ_G[\r][\n]"
Content-Disposition: form-data; name="summary"[\r][\n]"
Content-Type: text/plain; charset=UTF-8[\r][\n]"
Content-Transfer-Encoding: 8bit[\r][\n]"
[\r][\n]"
[\r][\n]"
--PLQFpiOkWB-IlgD6F8M-ynoOQoo8gwg3JfZ_G[\r][\n]"
Content-Disposition: form-data; name="category"[\r][\n]"
Content-Type: text/plain; charset=UTF-8[\r][\n]"
Content-Transfer-Encoding: 8bit[\r][\n]"
[\r][\n]"
scheme="http://www.cggh.org/2010/chassis/scheme/FileTypes";
term="http://www.cggh.org/2010/chassis/terms/DataFile"; label="";[\r][\n]"
--PLQFpiOkWB-IlgD6F8M-ynoOQoo8gwg3JfZ_G[\r][\n]"
Content-Disposition: form-data; name="media";
filename="upload_5b2be16b_131848ea9ec__7fea_00000490.tmp"[\r][\n]"
Content-Type: application/octet-stream[\r][\n]"
Content-Transfer-Encoding: binary[\r][\n]"
[\r][\n]"


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

Erik Bruchez
Administrator
Ian,

Do your xforms:upload controls have nested xforms:filename elements
pointing to your upload/@filename attribute in the instance?

-Erik

On Mon, Aug 1, 2011 at 4:40 AM, Ian Wright <[hidden email]> wrote:

> Hi,
>
> I'm trying to upload a file and I'm having difficultly in getting the file
> name correct
> I do this successfully elsewhere so I'm puzzled as to why this isn't
> working.
>
> The difference with the working instance is that when it works I'm uploading
> one file from the form so using the instance directly
> When it doesn't working there are multiple uploads and I'm copying each
> upload element into a different instance before submitting it.
> As far as I can see the submitted XML is the same.
>
> Any help gratefully received!
> Thanks,
> Ian
>
> The submission is:
> <xforms:submission id="sub-post-upload" method="form-data-post"
>
>  resource="{instance('ins-study-entry')/atom:link[@rel='http://www.cggh.org/2010/chassis/terms/curatedMedia']/@href}"
>        ref="instance('ins-upload')" replace="instance"
> instance="ins-upload-result-entry">
>
> <xforms:header>
> <xforms:name>Accept</xforms:name>
> <xforms:value>application/atom+xml</xforms:value>
> </xforms:header>
>
> <!-- clear out upload -->
> <!--
> <xforms:insert ev:event="xforms-submit-done"
> nodeset="instance('ins-upload')"
>            origin="instance('ins-upload-empty')" />
>  -->
>
> <!-- TODO error handling -->
> <xforms:message ev:event="xforms-submit-error" level="modal">
>            An error occurred (
> <xforms:output value="event('error-type')" />
>            ) while posting an upload.
> </xforms:message>
>
> </xforms:submission>
>
> I'm posting the following instance:
>
> <upload scheme="http://www.cggh.org/2010/chassis/scheme/FileTypes"
> term="http://www.cggh.org/2010/chassis/terms/DataFile" label=""
> xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
> xmlns:atom="http://www.w3.org/2005/Atom"
> xmlns:xi="http://www.w3.org/2001/XInclude"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:ev="http://www.w3.org/2001/xml-events"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:manta="http://www.cggh.org/2010/chassis/manta/xmlns"
> xmlns:atombeat="http://purl.org/atombeat/xmlns"
> xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
> xmlns:f="http://orbeon.org/oxf/xml/formatting"
> xmlns:xforms="http://www.w3.org/2002/xforms"><summary/><category>scheme="http://www.cggh.org/2010/chassis/scheme/FileTypes";
> term="http://www.cggh.org/2010/chassis/terms/DataFile";
> label="";</category><media xsi:type="xs:anyURI" filename="pharma-ssq-check"
> mediatype="application/octet-stream"
> size="2598">file:/C:/Users/iwright/AppData/Local/Temp/xforms_upload_8487334723859706788.tmp</media></upload>
>
> which is created by:
>
> <xforms:action xxforms:iterate="instance('ins-uploads')//upload">
> <xxforms:variable name="upload" select="."/>
> <xxforms:variable name="file-uri" select="media/text()" />
>
> <!--
>                         All this is to preserve the namespace declarations
> on the upload element
>                          -->
> <xforms:insert nodeset="instance('ins-upload')/*"
>                            origin="$upload/*" />
>
> <xforms:delete nodeset="instance('ins-upload')/*[3]" />
> <xforms:delete nodeset="instance('ins-upload')/*[2]" />
> <xforms:delete nodeset="instance('ins-upload')/*[1]" />
>
> <xforms:setvalue ref="instance('ins-upload')//category"
> value="concat('scheme=&quot;http://www.cggh.org/2010/chassis/scheme/FileTypes&quot;;
> term=&quot;',$upload/@term,'&quot;;
> label=&quot;',$upload/@label,'&quot;;')"/>
> <xforms:setvalue ref="instance('ins-upload')/@term" value="$upload/@term" />
> <xforms:setvalue ref="instance('ins-upload')/@label" value="$upload/@label"
> />
> <xforms:setvalue ref="instance('ins-upload')/@filename"
> value="$upload/media/@filename" />
> <xforms:send submission="sub-post-upload"/>
> </xforms:action>
>
> from:
> <uploads
> target="http://localhost:8080/repository/service/content/media/curated/YBZYR"
> xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
> xmlns:atom="http://www.w3.org/2005/Atom"
> xmlns:xi="http://www.w3.org/2001/XInclude"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:ev="http://www.w3.org/2001/xml-events"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:manta="http://www.cggh.org/2010/chassis/manta/xmlns"
> xmlns:atombeat="http://purl.org/atombeat/xmlns"
> xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
> xmlns:f="http://orbeon.org/oxf/xml/formatting"
> xmlns:xforms="http://www.w3.org/2002/xforms"><upload
> scheme="http://www.cggh.org/2010/chassis/scheme/FileTypes"
> term="http://www.cggh.org/2010/chassis/terms/DataFile"
> label=""><summary/><category/><media xsi:type="xs:anyURI"
> filename="pharma-ssq-check" mediatype="application/octet-stream"
> size="2598">file:/C:/Users/iwright/AppData/Local/Temp/xforms_upload_8487334723859706788.tmp</media></upload></uploads>
>
> which gives in the log
> POST /repository/service/content/media/curated/YBZYR HTTP/1.1[\r][\n]"
> Accept: application/atom+xml[\r][\n]"
> Cookie: JSESSIONID=0EC9046AA06E4F9628E7139E3E3187C6[\r][\n]"
> Content-Type: multipart/form-data;
> boundary=PLQFpiOkWB-IlgD6F8M-ynoOQoo8gwg3JfZ_G[\r][\n]"
> User-Agent: Jakarta Commons-HttpClient/3.1-rc1[\r][\n]"
> Host: localhost:8080[\r][\n]"
> Content-Length: 3326[\r][\n]"
> [\r][\n]"
> --PLQFpiOkWB-IlgD6F8M-ynoOQoo8gwg3JfZ_G[\r][\n]"
> Content-Disposition: form-data; name="summary"[\r][\n]"
> Content-Type: text/plain; charset=UTF-8[\r][\n]"
> Content-Transfer-Encoding: 8bit[\r][\n]"
> [\r][\n]"
> [\r][\n]"
> --PLQFpiOkWB-IlgD6F8M-ynoOQoo8gwg3JfZ_G[\r][\n]"
> Content-Disposition: form-data; name="category"[\r][\n]"
> Content-Type: text/plain; charset=UTF-8[\r][\n]"
> Content-Transfer-Encoding: 8bit[\r][\n]"
> [\r][\n]"
> scheme="http://www.cggh.org/2010/chassis/scheme/FileTypes";
> term="http://www.cggh.org/2010/chassis/terms/DataFile"; label="";[\r][\n]"
> --PLQFpiOkWB-IlgD6F8M-ynoOQoo8gwg3JfZ_G[\r][\n]"
> Content-Disposition: form-data; name="media";
> filename="upload_5b2be16b_131848ea9ec__7fea_00000490.tmp"[\r][\n]"
> Content-Type: application/octet-stream[\r][\n]"
> Content-Transfer-Encoding: binary[\r][\n]"
> [\r][\n]"
>
>
> --
> 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
>
>


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

idwright
Hi Erik,

That does help solve the problem - many thanks.

The xforms:filename points at
instance('ins-uploads')/upload/media/@filename and I've been copying
each instance('ins-uploads')/upload into instance('ins-upload') before
posting it so that I can post one file at a time.
(I can't remember exactly how I was doing it at the time but at one
stage I had problems with the namespace not being recognised for
xsi:type="xs:anyURI" when attempting to use the upload element on it's
own, as it doesn't contain the namespace definitions, - hence the rather
convoluted code below)

Ian
On 19:59, Erik Bruchez wrote:

> Ian,
>
> Do your xforms:upload controls have nested xforms:filename elements
> pointing to your upload/@filename attribute in the instance?
>
> -Erik
>
> On Mon, Aug 1, 2011 at 4:40 AM, Ian Wright<[hidden email]>  wrote:
>> Hi,
>>
>> I'm trying to upload a file and I'm having difficultly in getting the file
>> name correct
>> I do this successfully elsewhere so I'm puzzled as to why this isn't
>> working.
>>
>> The difference with the working instance is that when it works I'm uploading
>> one file from the form so using the instance directly
>> When it doesn't working there are multiple uploads and I'm copying each
>> upload element into a different instance before submitting it.
>> As far as I can see the submitted XML is the same.
>>
>> Any help gratefully received!
>> Thanks,
>> Ian
>>
>> The submission is:
>> <xforms:submission id=ub-post-upload" method="form-data-post"
>>
>>   resource=instance('ins-study-entry')/atom:link[@rel='http://www.cggh.org/2010/chassis/terms/curatedMedia']/@href}"
>>         ref=nstance('ins-upload')" replace="instance"
>> instance=ns-upload-result-entry">
>>
>> <xforms:header>
>> <xforms:name>Accept</xforms:name>
>> <xforms:value>application/atom+xml</xforms:value>
>> </xforms:header>
>>
>> <!-- clear out upload -->
>> <!--
>> <xforms:insert ev:event=forms-submit-done"
>> nodeset=nstance('ins-upload')"
>>             origin=nstance('ins-upload-empty')" />
>>   -->
>>
>> <!-- TODO error handling -->
>> <xforms:message ev:event=forms-submit-error" level="modal">
>>             An error occurred (
>> <xforms:output value=vent('error-type')" />
>>             ) while posting an upload.
>> </xforms:message>
>>
>> </xforms:submission>
>>
>> I'm posting the following instance:
>>
>> <upload scheme=ttp://www.cggh.org/2010/chassis/scheme/FileTypes"
>> term=ttp://www.cggh.org/2010/chassis/terms/DataFile" label=""
>> xmlns:xxforms=ttp://orbeon.org/oxf/xml/xforms"
>> xmlns:atom=ttp://www.w3.org/2005/Atom"
>> xmlns:xi=ttp://www.w3.org/2001/XInclude"
>> xmlns:xs=ttp://www.w3.org/2001/XMLSchema"
>> xmlns:ev=ttp://www.w3.org/2001/xml-events"
>> xmlns:xsi=ttp://www.w3.org/2001/XMLSchema-instance"
>> xmlns:manta=ttp://www.cggh.org/2010/chassis/manta/xmlns"
>> xmlns:atombeat=ttp://purl.org/atombeat/xmlns"
>> xmlns:fr=ttp://orbeon.org/oxf/xml/form-runner"
>> xmlns:f=ttp://orbeon.org/oxf/xml/formatting"
>> xmlns:xforms=ttp://www.w3.org/2002/xforms"><summary/><category>scheme="http://www.cggh.org/2010/chassis/scheme/FileTypes";
>> term=ttp://www.cggh.org/2010/chassis/terms/DataFile";
>> label=;</category><media xsi:type="xs:anyURI" filename="pharma-ssq-check"
>> mediatype=pplication/octet-stream"
>> size=598">file:/C:/Users/iwright/AppData/Local/Temp/xforms_upload_8487334723859706788.tmp</media></upload>
>>
>> which is created by:
>>
>> <xforms:action xxforms:iterate=nstance('ins-uploads')//upload">
>> <xxforms:variable name=pload" select="."/>
>> <xxforms:variable name=ile-uri" select="media/text()" />
>>
>> <!--
>>                          All this is to preserve the namespace declarations
>> on the upload element
>>                           -->
>> <xforms:insert nodeset=nstance('ins-upload')/*"
>>                             origin=upload/*" />
>>
>> <xforms:delete nodeset=nstance('ins-upload')/*[3]" />
>> <xforms:delete nodeset=nstance('ins-upload')/*[2]" />
>> <xforms:delete nodeset=nstance('ins-upload')/*[1]" />
>>
>> <xforms:setvalue ref=nstance('ins-upload')//category"
>> value=oncat('scheme=&quot;http://www.cggh.org/2010/chassis/scheme/FileTypes&quot;;
>> term=uot;',$upload/@term,'&quot;;
>> label=uot;',$upload/@label,'&quot;;')"/>
>> <xforms:setvalue ref=nstance('ins-upload')/@term" value="$upload/@term" />
>> <xforms:setvalue ref=nstance('ins-upload')/@label" value="$upload/@label"
>> />
>> <xforms:setvalue ref=nstance('ins-upload')/@filename"
>> value=upload/media/@filename" />
>> <xforms:send submission=ub-post-upload"/>
>> </xforms:action>
>>
>> from:
>> <uploads
>> target=ttp://localhost:8080/repository/service/content/media/curated/YBZYR"
>> xmlns:xxforms=ttp://orbeon.org/oxf/xml/xforms"
>> xmlns:atom=ttp://www.w3.org/2005/Atom"
>> xmlns:xi=ttp://www.w3.org/2001/XInclude"
>> xmlns:xs=ttp://www.w3.org/2001/XMLSchema"
>> xmlns:ev=ttp://www.w3.org/2001/xml-events"
>> xmlns:xsi=ttp://www.w3.org/2001/XMLSchema-instance"
>> xmlns:manta=ttp://www.cggh.org/2010/chassis/manta/xmlns"
>> xmlns:atombeat=ttp://purl.org/atombeat/xmlns"
>> xmlns:fr=ttp://orbeon.org/oxf/xml/form-runner"
>> xmlns:f=ttp://orbeon.org/oxf/xml/formatting"
>> xmlns:xforms=ttp://www.w3.org/2002/xforms"><upload
>> scheme=ttp://www.cggh.org/2010/chassis/scheme/FileTypes"
>> term=ttp://www.cggh.org/2010/chassis/terms/DataFile"
>> label=><summary/><category/><media xsi:type="xs:anyURI"
>> filename=harma-ssq-check" mediatype="application/octet-stream"
>> size=598">file:/C:/Users/iwright/AppData/Local/Temp/xforms_upload_8487334723859706788.tmp</media></upload></uploads>
>>
>> which gives in the log
>> POST /repository/service/content/media/curated/YBZYR HTTP/1.1[\r][\n]"
>> Accept: application/atom+xml[\r][\n]"
>> Cookie: JSESSIONIDC9046AA06E4F9628E7139E3E3187C6[\r][\n]"
>> Content-Type: multipart/form-data;
>> boundary=QFpiOkWB-IlgD6F8M-ynoOQoo8gwg3JfZ_G[\r][\n]"
>> User-Agent: Jakarta Commons-HttpClient/3.1-rc1[\r][\n]"
>> Host: localhost:8080[\r][\n]"
>> Content-Length: 3326[\r][\n]"
>> [\r][\n]"
>> --PLQFpiOkWB-IlgD6F8M-ynoOQoo8gwg3JfZ_G[\r][\n]"
>> Content-Disposition: form-data; name=ummary"[\r][\n]"
>> Content-Type: text/plain; charset=F-8[\r][\n]"
>> Content-Transfer-Encoding: 8bit[\r][\n]"
>> [\r][\n]"
>> [\r][\n]"
>> --PLQFpiOkWB-IlgD6F8M-ynoOQoo8gwg3JfZ_G[\r][\n]"
>> Content-Disposition: form-data; name=ategory"[\r][\n]"
>> Content-Type: text/plain; charset=F-8[\r][\n]"
>> Content-Transfer-Encoding: 8bit[\r][\n]"
>> [\r][\n]"
>> scheme=ttp://www.cggh.org/2010/chassis/scheme/FileTypes";
>> term=ttp://www.cggh.org/2010/chassis/terms/DataFile"; label="";[\r][\n]"
>> --PLQFpiOkWB-IlgD6F8M-ynoOQoo8gwg3JfZ_G[\r][\n]"
>> Content-Disposition: form-data; name=edia";
>> filename=pload_5b2be16b_131848ea9ec__7fea_00000490.tmp"[\r][\n]"
>> Content-Type: application/octet-stream[\r][\n]"
>> Content-Transfer-Encoding: binary[\r][\n]"
>> [\r][\n]"
>>
>>
>> --
>> 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=lp
>> OW2 mailing lists service home page: http://www.ow2.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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: file upload filename

Erik Bruchez
Administrator
Ian,

Great to hear that the issue is solved!

-Erik

On Fri, Aug 5, 2011 at 1:28 AM, Ian Wright <[hidden email]> wrote:

> Hi Erik,
>
> That does help solve the problem - many thanks.
>
> The xforms:filename points at instance('ins-uploads')/upload/media/@filename
> and I've been copying each instance('ins-uploads')/upload into
> instance('ins-upload') before posting it so that I can post one file at a
> time.
> (I can't remember exactly how I was doing it at the time but at one stage I
> had problems with the namespace not being recognised for
> xsi:type="xs:anyURI" when attempting to use the upload element on it's own,
> as it doesn't contain the namespace definitions, - hence the rather
> convoluted code below)
>
> Ian
> On 19:59, Erik Bruchez wrote:
>>
>> Ian,
>>
>> Do your xforms:upload controls have nested xforms:filename elements
>> pointing to your upload/@filename attribute in the instance?
>>
>> -Erik
>>
>> On Mon, Aug 1, 2011 at 4:40 AM, Ian Wright<[hidden email]>
>>  wrote:
>>>
>>> Hi,
>>>
>>> I'm trying to upload a file and I'm having difficultly in getting the
>>> file
>>> name correct
>>> I do this successfully elsewhere so I'm puzzled as to why this isn't
>>> working.
>>>
>>> The difference with the working instance is that when it works I'm
>>> uploading
>>> one file from the form so using the instance directly
>>> When it doesn't working there are multiple uploads and I'm copying each
>>> upload element into a different instance before submitting it.
>>> As far as I can see the submitted XML is the same.
>>>
>>> Any help gratefully received!
>>> Thanks,
>>> Ian
>>>
>>> The submission is:
>>> <xforms:submission id=ub-post-upload" method="form-data-post"
>>>
>>>
>>>  resource=instance('ins-study-entry')/atom:link[@rel='http://www.cggh.org/2010/chassis/terms/curatedMedia']/@href}"
>>>        ref=nstance('ins-upload')" replace="instance"
>>> instance=ns-upload-result-entry">
>>>
>>> <xforms:header>
>>> <xforms:name>Accept</xforms:name>
>>> <xforms:value>application/atom+xml</xforms:value>
>>> </xforms:header>
>>>
>>> <!-- clear out upload -->
>>> <!--
>>> <xforms:insert ev:event=forms-submit-done"
>>> nodeset=nstance('ins-upload')"
>>>            origin=nstance('ins-upload-empty')" />
>>>  -->
>>>
>>> <!-- TODO error handling -->
>>> <xforms:message ev:event=forms-submit-error" level="modal">
>>>            An error occurred (
>>> <xforms:output value=vent('error-type')" />
>>>            ) while posting an upload.
>>> </xforms:message>
>>>
>>> </xforms:submission>
>>>
>>> I'm posting the following instance:
>>>
>>> <upload scheme=ttp://www.cggh.org/2010/chassis/scheme/FileTypes"
>>> term=ttp://www.cggh.org/2010/chassis/terms/DataFile" label=""
>>> xmlns:xxforms=ttp://orbeon.org/oxf/xml/xforms"
>>> xmlns:atom=ttp://www.w3.org/2005/Atom"
>>> xmlns:xi=ttp://www.w3.org/2001/XInclude"
>>> xmlns:xs=ttp://www.w3.org/2001/XMLSchema"
>>> xmlns:ev=ttp://www.w3.org/2001/xml-events"
>>> xmlns:xsi=ttp://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:manta=ttp://www.cggh.org/2010/chassis/manta/xmlns"
>>> xmlns:atombeat=ttp://purl.org/atombeat/xmlns"
>>> xmlns:fr=ttp://orbeon.org/oxf/xml/form-runner"
>>> xmlns:f=ttp://orbeon.org/oxf/xml/formatting"
>>>
>>> xmlns:xforms=ttp://www.w3.org/2002/xforms"><summary/><category>scheme="http://www.cggh.org/2010/chassis/scheme/FileTypes";
>>> term=ttp://www.cggh.org/2010/chassis/terms/DataFile";
>>> label=;</category><media xsi:type="xs:anyURI" filename="pharma-ssq-check"
>>> mediatype=pplication/octet-stream"
>>>
>>> size=598">file:/C:/Users/iwright/AppData/Local/Temp/xforms_upload_8487334723859706788.tmp</media></upload>
>>>
>>> which is created by:
>>>
>>> <xforms:action xxforms:iterate=nstance('ins-uploads')//upload">
>>> <xxforms:variable name=pload" select="."/>
>>> <xxforms:variable name=ile-uri" select="media/text()" />
>>>
>>> <!--
>>>                         All this is to preserve the namespace
>>> declarations
>>> on the upload element
>>>                          -->
>>> <xforms:insert nodeset=nstance('ins-upload')/*"
>>>                            origin=upload/*" />
>>>
>>> <xforms:delete nodeset=nstance('ins-upload')/*[3]" />
>>> <xforms:delete nodeset=nstance('ins-upload')/*[2]" />
>>> <xforms:delete nodeset=nstance('ins-upload')/*[1]" />
>>>
>>> <xforms:setvalue ref=nstance('ins-upload')//category"
>>>
>>> value=oncat('scheme=&quot;http://www.cggh.org/2010/chassis/scheme/FileTypes&quot;;
>>> term=uot;',$upload/@term,'&quot;;
>>> label=uot;',$upload/@label,'&quot;;')"/>
>>> <xforms:setvalue ref=nstance('ins-upload')/@term" value="$upload/@term"
>>> />
>>> <xforms:setvalue ref=nstance('ins-upload')/@label" value="$upload/@label"
>>> />
>>> <xforms:setvalue ref=nstance('ins-upload')/@filename"
>>> value=upload/media/@filename" />
>>> <xforms:send submission=ub-post-upload"/>
>>> </xforms:action>
>>>
>>> from:
>>> <uploads
>>>
>>> target=ttp://localhost:8080/repository/service/content/media/curated/YBZYR"
>>> xmlns:xxforms=ttp://orbeon.org/oxf/xml/xforms"
>>> xmlns:atom=ttp://www.w3.org/2005/Atom"
>>> xmlns:xi=ttp://www.w3.org/2001/XInclude"
>>> xmlns:xs=ttp://www.w3.org/2001/XMLSchema"
>>> xmlns:ev=ttp://www.w3.org/2001/xml-events"
>>> xmlns:xsi=ttp://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:manta=ttp://www.cggh.org/2010/chassis/manta/xmlns"
>>> xmlns:atombeat=ttp://purl.org/atombeat/xmlns"
>>> xmlns:fr=ttp://orbeon.org/oxf/xml/form-runner"
>>> xmlns:f=ttp://orbeon.org/oxf/xml/formatting"
>>> xmlns:xforms=ttp://www.w3.org/2002/xforms"><upload
>>> scheme=ttp://www.cggh.org/2010/chassis/scheme/FileTypes"
>>> term=ttp://www.cggh.org/2010/chassis/terms/DataFile"
>>> label=><summary/><category/><media xsi:type="xs:anyURI"
>>> filename=harma-ssq-check" mediatype="application/octet-stream"
>>>
>>> size=598">file:/C:/Users/iwright/AppData/Local/Temp/xforms_upload_8487334723859706788.tmp</media></upload></uploads>
>>>
>>> which gives in the log
>>> POST /repository/service/content/media/curated/YBZYR HTTP/1.1[\r][\n]"
>>> Accept: application/atom+xml[\r][\n]"
>>> Cookie: JSESSIONID C9046AA06E4F9628E7139E3E3187C6[\r][\n]"
>>> Content-Type: multipart/form-data;
>>> boundary=QFpiOkWB-IlgD6F8M-ynoOQoo8gwg3JfZ_G[\r][\n]"
>>> User-Agent: Jakarta Commons-HttpClient/3.1-rc1[\r][\n]"
>>> Host: localhost:8080[\r][\n]"
>>> Content-Length: 3326[\r][\n]"
>>> [\r][\n]"
>>> --PLQFpiOkWB-IlgD6F8M-ynoOQoo8gwg3JfZ_G[\r][\n]"
>>> Content-Disposition: form-data; name=ummary"[\r][\n]"
>>> Content-Type: text/plain; charset=F-8[\r][\n]"
>>> Content-Transfer-Encoding: 8bit[\r][\n]"
>>> [\r][\n]"
>>> [\r][\n]"
>>> --PLQFpiOkWB-IlgD6F8M-ynoOQoo8gwg3JfZ_G[\r][\n]"
>>> Content-Disposition: form-data; name=ategory"[\r][\n]"
>>> Content-Type: text/plain; charset=F-8[\r][\n]"
>>> Content-Transfer-Encoding: 8bit[\r][\n]"
>>> [\r][\n]"
>>> scheme=ttp://www.cggh.org/2010/chassis/scheme/FileTypes";
>>> term=ttp://www.cggh.org/2010/chassis/terms/DataFile"; label="";[\r][\n]"
>>> --PLQFpiOkWB-IlgD6F8M-ynoOQoo8gwg3JfZ_G[\r][\n]"
>>> Content-Disposition: form-data; name=edia";
>>> filename=pload_5b2be16b_131848ea9ec__7fea_00000490.tmp"[\r][\n]"
>>> Content-Type: application/octet-stream[\r][\n]"
>>> Content-Transfer-Encoding: binary[\r][\n]"
>>> [\r][\n]"
>>>
>>>
>>> --
>>> 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=lp
>>> OW2 mailing lists service home page: http://www.ow2.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
> OW2 mailing lists service home page: http://www.ow2.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
OW2 mailing lists service home page: http://www.ow2.org/wws