From mymir.org at googlemail.com Tue Jan 19 15:43:18 2010
From: mymir.org at googlemail.com (Vladislav Vorobiev)
Date: Tue, 19 Jan 2010 15:43:18 +0100
Subject: [Kss-devel] How to send an multipart/form-data formular and not a
application/x-www-form-urlencoded(standart)
Message-ID: <604c02231001190643x629f892bl8a243cebe524a61b@mail.gmail.com>
Hello!
I need to send an Formular with Content-Type ? multipart/form-data?.
The File that I send is a image. Kss send it as a string.
Kss send something like this.
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
form.image=1.JPG
It must be like this.
Content-Type: multipart/form-data;
Content-Disposition: form-data; name="form.image"; filename="1.JPG"
Content-Type: image/jpeg
????CONTENTCONTENTCONTENT_DATA.
My kss:
#bla:click {
evt-click-preventdefault: true;
evt-click-allowbubbling: true;
action-server: testKss;
testKss-kssSubmitForm: currentForm();
}
My form:
How I can tell KSS to send my form multipart/form-data? Can't find
this feature in in the Doku.
--
Best Regards
Vlad Vorobiev
From ree at greenfinity.hu Tue Jan 19 17:01:39 2010
From: ree at greenfinity.hu (Balazs Ree)
Date: Tue, 19 Jan 2010 17:01:39 +0100
Subject: [Kss-devel] How to send an multipart/form-data formular and not
a application/x-www-form-urlencoded(standart)
References: <604c02231001190643x629f892bl8a243cebe524a61b@mail.gmail.com>
Message-ID:
On Tue, 19 Jan 2010 15:43:18 +0100, Vladislav Vorobiev wrote:
> Hello!
>
> I need to send an Formular with Content-Type ? multipart/form-data?.
> The File that I send is a image. Kss send it as a string.
>
> Kss send something like this.
> Content-Type: application/x-www-form-urlencoded; charset=UTF-8
>
> form.image=1.JPG
>
> It must be like this.
>
> Content-Type: multipart/form-data;
> Content-Disposition: form-data; name="form.image"; filename="1.JPG"
>
> Content-Type: image/jpeg
>
> ????CONTENTCONTENTCONTENT_DATA.
>
> My kss:
>
> #bla:click {
> evt-click-preventdefault: true;
> evt-click-allowbubbling: true;
> action-server: testKss;
> testKss-kssSubmitForm: currentForm();
> }
>
> My form:
>
>
>
> How I can tell KSS to send my form multipart/form-data? Can't find this
> feature in in the Doku.
In general, when KSS executes a server action, it makes an
XMLHttpRequest. XMLHttpRequest is only capable of downloading, it is not
capable of uploading a file. The lack of ajax file upload is not a
limitation of KSS but a limitation built into the browsers, partly
intentionally (security concerns), partly due to lack of support for
these features in a cross-browser compatible api.
In the new Firefoxes (3.6 and above), XMLHttpRequest _can_ be used for
uploading, with some caveats. Needless to say, no other browsers support
this. However, even in this case, there is no way to access any files
from the filesystem by program code. The user needs to actually go
through the browse dialog and select the file. So but again, this would
not work on all browsers.
There is a workaround that still makes it possible to upload files with
ajax. The trick is to create a hidden form in an iframe. The actual
tag then needs to be copied into this form, after the
user has already selected the file into it. Later on, the form will be
submitted as a form, not as an XMLHttpRequest. There is existing
javascript code that does this for you, so someone could make a simple
wrapper for this code as a kss plugin which would make it possible to
work this way. There is however no chance really, that the standard
action-server would ever support this: it would be a plugin on its own.
--
Balazs Ree Greenfinity LLC.
Python, Zope, Plone http://greenfinity.hu
From mymir.org at googlemail.com Mon Jan 25 19:34:16 2010
From: mymir.org at googlemail.com (Vladislav Vorobiev)
Date: Mon, 25 Jan 2010 19:34:16 +0100
Subject: [Kss-devel] How to send an multipart/form-data formular and not
a application/x-www-form-urlencoded(standart)
In-Reply-To:
References: <604c02231001190643x629f892bl8a243cebe524a61b@mail.gmail.com>
Message-ID: <604c02231001251034o68004bd1u9f420c268201a0e9@mail.gmail.com>
Hello.
I supposed that. Thank you for the detail Answer.
Best Regards
Vlad
2010/1/19 Balazs Ree :
> On Tue, 19 Jan 2010 15:43:18 +0100, Vladislav Vorobiev wrote:
>
>> Hello!
>>
>> I need to send an ?Formular with Content-Type ? multipart/form-data?.
>> The File that I send is a image. Kss send it as a string.
>>
>> Kss send something like this.
>> Content-Type: application/x-www-form-urlencoded; charset=UTF-8
>>
>> form.image=1.JPG
>>
>> It must be like this.
>>
>> Content-Type: multipart/form-data;
>> Content-Disposition: form-data; name="form.image"; filename="1.JPG"
>>
>> Content-Type: image/jpeg
>>
>> ????CONTENTCONTENTCONTENT_DATA.
>>
>> My kss:
>>
>> #bla:click {
>> ? ?evt-click-preventdefault: true;
>> ? ?evt-click-allowbubbling: true;
>> ? ?action-server: testKss;
>> ? ?testKss-kssSubmitForm: currentForm();
>> }
>>
>> My form:
>>
>>
>>
>> How I can tell KSS to send my form ?multipart/form-data? Can't find this
>> feature in ?in the Doku.
>
> In general, when KSS executes a server action, it makes an
> XMLHttpRequest. XMLHttpRequest is only capable of downloading, it is not
> capable of uploading a file. The lack of ajax file upload is not a
> limitation of KSS but a limitation built into the browsers, partly
> intentionally (security concerns), partly due to lack of support for
> these features in a cross-browser compatible api.
>
> In the new Firefoxes (3.6 and above), XMLHttpRequest _can_ be used for
> uploading, with some caveats. Needless to say, no other browsers support
> this. However, even in this case, there is no way to access any files
> from the filesystem by program code. The user needs to actually go
> through the browse dialog and select the file. So but again, this would
> not work on all browsers.
>
> There is a workaround that still makes it possible to upload files with
> ajax. The trick is to create a hidden form in an iframe. The actual
> tag then needs to be copied into this form, after the
> user has already selected the file into it. Later on, the form will be
> submitted as a form, not as an XMLHttpRequest. There is existing
> javascript code that does this for you, so someone could make a simple
> wrapper for this code as a kss plugin which would make it possible to
> work this way. There is however no chance really, that the standard
> action-server would ever support this: it would be a plugin on its own.
>
>
> --
> Balazs Ree ? ? ? ? ? ? ? ? Greenfinity LLC.
> Python, Zope, Plone ? ? ? ?http://greenfinity.hu
>
> _______________________________________________
> Kss-devel mailing list
> Kss-devel at codespeak.net
> http://codespeak.net/mailman/listinfo/kss-devel
>
--
Best Regards
Vlad Vorobiev