upload file

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

upload file

Jarosław Kowalewski
Hi,

How can I get the base64 content from xml as a file? In xforms is control
xf:upload. I want to have a trigger in my xforms form, that decode the
contant and give me a file e.g. myfile.txt. It's possible without using
server?

Jarek
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

RE: upload file

Klotz, Leigh
No matter what you do, the server has to cooperate by storing the file.  There's no way to get the file contents inside your XForms page itself because that's limited by security concerns.

If you're using the Mozilla XForms implementation, I believe it supports the multipart/related type, which will give you a multipart/related media upload.

<submission method="multipart-post" action="save.cgi" ... />
<instance>
   <data xmlns="">
      <title />
      <file />
   </data>
</instance>

<bind nodeset="file" type="xsd:anyURI" />

<upload ref="file">
   <label>File to upload</label>
</upload>


You will then get the file posted as a separate MIME part to your server.  The XML will have the file element contain the URI of the MIME part, which you may be able to ask your server to convert to the uploaded file name.

You may also try the form-data-post which will give the same type of file upload as HTML4 <input type="file"> does when the form has <form enctype="multipart/form-data">.
You will not get your other form data as XML in that case; each will be its own separate MIME part, but your server may be able to provide support for multipart/form-data if it doesn't have support for multipart/related.

Leigh.

-----Original Message-----
From: dev-tech-xforms-bounces+leigh.klotz=[hidden email] [mailto:dev-tech-xforms-bounces+leigh.klotz=[hidden email]] On Behalf Of Jaroslaw Kowalewski
Sent: Thursday, March 04, 2010 11:10 AM
To: [hidden email]
Subject: upload file

Hi,

How can I get the base64 content from xml as a file? In xforms is control xf:upload. I want to have a trigger in my xforms form, that decode the contant and give me a file e.g. myfile.txt. It's possible without using server?

Jarek
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: upload file

RajaM-2
In reply to this post by Jarosław Kowalewski
On Mar 5, 12:18 am, "Klotz, Leigh" <[hidden email]> wrote:

> No matter what you do, the server has to cooperate by storing the file.  There's no way to get the file contents inside your XForms page itself because that's limited by security concerns.
>
> If you're using the Mozilla XForms implementation, I believe it supports the multipart/related type, which will give you a multipart/related media upload.
>
> <submission method="multipart-post" action="save.cgi" ... />
> <instance>
>    <data xmlns="">
>       <title />
>       <file />
>    </data>
> </instance>
>
> <bind nodeset="file" type="xsd:anyURI" />
>
> <upload ref="file">
>    <label>File to upload</label>
> </upload>
>
> You will then get the file posted as a separate MIME part to your server.  The XML will have the file element contain the URI of the MIME part, which you may be able to ask your server to convert to the uploaded file name.
>
> You may also try the form-data-post which will give the same type of file upload as HTML4 <input type="file"> does when the form has <form enctype="multipart/form-data">.
> You will not get your other form data as XML in that case; each will be its own separate MIME part, but your server may be able to provide support for multipart/form-data if it doesn't have support for multipart/related.
>
> Leigh.
>
> -----Original Message-----
> From: dev-tech-xforms-bounces+leigh.klotz=[hidden email] [mailto:dev-tech-xforms-bounces+leigh.klotz=[hidden email]] On Behalf Of Jaroslaw Kowalewski
> Sent: Thursday, March 04, 2010 11:10 AM
> To: [hidden email]
> Subject: upload file
>
> Hi,
>
> How can I get the base64 content from xml as a file? In xforms is control xf:upload. I want to have a trigger in my xforms form, that decode the contant and give me a file e.g. myfile.txt. It's possible without using server?
>
> Jarek
> _______________________________________________
> dev-tech-xforms mailing list
> [hidden email]://lists.mozilla.org/listinfo/dev-tech-xforms

Hi
Have u got the solution for that query ....
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: upload file

Vyacheslav Sedov
we use something like this

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <head test="test">
        <title>Add content</title>
  <xf:model id="theModel">
    <xf:instance id="theData">
      <post xmlns="" action="add-category">
<url/>
          <file/>
      </post>
    </xf:instance>
    <xf:bind id="url" nodeset="/post/url" type="xsd:string"
required="true()" validate="true()"/>
    <xf:bind id="file" nodeset="/post/file" type="xsd:base64Binary"
required="true()"/>
      <xf:submission id="submit" ref="/" method="post"
serialization="application/xml" resource="/add-content.action"/>
  </xf:model>
</head>

<body>
        <h1>Add content</h1>
        <xf:input bind="url">
          <xf:label>URL</xf:label>
        </xf:input>
    <xf:upload bind="file">
            <xf:label>odf file</xf:label>
</xf:upload>
<xf:submit submission="submit">
    <xf:label>Publish</xf:label>
</xf:submit>

</body>

</html>

2010/3/16 RajaM <[hidden email]>:

> On Mar 5, 12:18 am, "Klotz, Leigh" <[hidden email]> wrote:
>> No matter what you do, the server has to cooperate by storing the file.  There's no way to get the file contents inside your XForms page itself because that's limited by security concerns.
>>
>> If you're using the Mozilla XForms implementation, I believe it supports the multipart/related type, which will give you a multipart/related media upload.
>>
>> <submission method="multipart-post" action="save.cgi" ... />
>> <instance>
>>    <data xmlns="">
>>       <title />
>>       <file />
>>    </data>
>> </instance>
>>
>> <bind nodeset="file" type="xsd:anyURI" />
>>
>> <upload ref="file">
>>    <label>File to upload</label>
>> </upload>
>>
>> You will then get the file posted as a separate MIME part to your server.  The XML will have the file element contain the URI of the MIME part, which you may be able to ask your server to convert to the uploaded file name.
>>
>> You may also try the form-data-post which will give the same type of file upload as HTML4 <input type="file"> does when the form has <form enctype="multipart/form-data">.
>> You will not get your other form data as XML in that case; each will be its own separate MIME part, but your server may be able to provide support for multipart/form-data if it doesn't have support for multipart/related.
>>
>> Leigh.
>>
>> -----Original Message-----
>> From: dev-tech-xforms-bounces+leigh.klotz=[hidden email] [mailto:dev-tech-xforms-bounces+leigh.klotz=[hidden email]] On Behalf Of Jaroslaw Kowalewski
>> Sent: Thursday, March 04, 2010 11:10 AM
>> To: [hidden email]
>> Subject: upload file
>>
>> Hi,
>>
>> How can I get the base64 content from xml as a file? In xforms is control xf:upload. I want to have a trigger in my xforms form, that decode the contant and give me a file e.g. myfile.txt. It's possible without using server?
>>
>> Jarek
>> _______________________________________________
>> dev-tech-xforms mailing list
>> [hidden email]://lists.mozilla.org/listinfo/dev-tech-xforms
>
> Hi
> Have u got the solution for that query ....
> _______________________________________________
> dev-tech-xforms mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-tech-xforms
>
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms