Upload files via ajax using jquery.form

26 views
Skip to first unread message

pa...@cancamusa.net

unread,
Aug 11, 2015, 5:30:39 PM8/11/15
to web2py-users
The web2py book says:

Because Ajax post does not support multipart forms, i.e. file uploads, upload
fields will not work with the LOAD component

This is a pity, as we are expected to split backend and frontend these days, and ajax comes handy. I have found other people hitted the same problem but didn't find a solution:

Then I realized there is one part of my app that has been doing file uploads via ajax for a long time. I grabbed it from this example appliance by Massimo, and never researched the code in depth:


https://github.com/mdipierro/web2py-appliances/tree/master/FileManager


I did some research and found it is using the jQuery.form library, which can do file uploads via ajax:


http://malsup.com/jquery/form/#file-upload


I write this in the hope that people trying to do fle uploads via ajax find this library, and the example app by Massimo, and it helps them.

Reply all
Reply to author
Forward
0 new messages