Autoupload a file

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

Autoupload a file

Bernat Romagosa
Hi list,

I have a file input field, and I'd like the file to be automatically uploaded when browsing is done, instead of forcing the user to click on a submit button.

I've tried:

h form buid: [:f |
f file
beSubmitOnChange;
action: [ :file | file doWhatever ]].

And it seems like it almost works, as the progress bar is rendered, but it fails to actually upload the file. Any ideas?

Thanks!

Bernat.

--
Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: Autoupload a file

Bernat Romagosa
I reply to myself in case someone runs into the same need in the future:

h form
id: 'file-upload-form';
beMultipart;
build: [ :f | 
f file
onChange: 'document.forms["file-upload-form"].submit()';
action: [ :file | file doSomething ]]

However, maybe it'd be nice to override #beSubmitOnChange in case the input field is a file input, so that it executes this code instead of the default one.

Cheers,

Bernat.

2012/6/13 Bernat Romagosa <[hidden email]>
Hi list,

I have a file input field, and I'd like the file to be automatically uploaded when browsing is done, instead of forcing the user to click on a submit button.

I've tried:

h form buid: [:f |
f file
beSubmitOnChange;
action: [ :file | file doWhatever ]].

And it seems like it almost works, as the progress bar is rendered, but it fails to actually upload the file. Any ideas?

Thanks!

Bernat.

--
Bernat Romagosa.



--
Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: Autoupload a file

sebastien audier
Congratulation Bernat,

Sorry for the late, we have a lot of work at the moment, but, I confess I had no idea in mind.

So thank's again.

--
Sébastien AUDIER

S.A.R.L Objectfusion
Applications web, consulting, design,
site Internet, Promotion de projets.


Reply | Threaded
Open this post in threaded view
|

Re: Autoupload a file

Bernat Romagosa
No problem Sebastien, I know this is a tiny community ;)

2012/6/14 Sebastien Audier <[hidden email]>
Congratulation Bernat,

Sorry for the late, we have a lot of work at the moment, but, I confess I had no idea in mind.

So thank's again.

--
Sébastien AUDIER

S.A.R.L Objectfusion
Applications web, consulting, design,
site Internet, Promotion de projets.





--
Bernat Romagosa.