upload file in ajax with wtforms
Asked Answered
E

1

2

I use wtforms to handle forms. so i create form like this:

class ProfileForm(Form):
    firstName = TextField(_('firstName'), [validators.Required(), validators.Length(min=3, max=45)])
    lastName = TextField(_('lastName'), [validators.Required(), validators.Length(min=3, max=45)])
    avatar = FileField(_('avatar'), [check_file])

this form work in simple upload fine ... but what about ajax ?

is there any plugin to create iFrame or somethings to upload file via ajax? or i must handle this form in another way?

ps: IE support be important

ps2: i use wtform for another without file in ajax to. just by serialize form and submit it ...

Eggshaped answered 19/1, 2013 at 17:8 Comment(1)
Did you figure this out?Keek
I
1

You should try installing and using Flask-Sijax. It uses JQuery and AJAX.

http://packages.python.org/Flask-Sijax/

It also has an example on uploading via AJAX.

Indestructible answered 20/1, 2013 at 19:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.