I'm looking for a similar solution, but the front-end is written in VueJs, and Axios for POST and GET requests, since I couldn'd find a way to send the actual file to the server I'm going with a solution close to your second option, has some extra steps but it's clean and somehow more verbose for multiple uploads, loading notifications and progress tracker.
2018-02-05 18:48 GMT-03:00 Πέτρος Χατζηλάμπρος <chatzilamp...@gmail.com>: > Dear all, > in my last project I am using the following architecture: > > - Web2py is used only at the back-end. > - The front-end is developed using React by an other developer. > - The front end sends GET and POST requests to web2py and web2py > responds with json. > > Using this architecture what is the best way to send and store an image > from the browser to the web2py ? I am thinking to use one of the three > following methods: > > - use a web2py controller to create a form with an upload field, sent > the hidden form inputs(_formkey and _formname) to front-end and then the > front-end will use javascript to imitate the behavior of the browser > - The front-end will use javascript to convert the file to base64 > format and it will send it with a POST request to web2py. Then web2py will > convert the base64 string into a file and it will save it to folder > /uploads using a controller > > Which method you think that fits better to web2py ? > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- -----BEGIN GEEK CODE BLOCK----- version 3.1 GCS/GTW/| d? s+:+>+++ a-- C+++(+++++) UL++++>$ P++>+++ L+++>+$ E->+ W++>+ N>+++ o K- w---(++++) O(--) M>-- V-- PS++ PE++>+ Y-->+ PGP+>+++ t-(?) 5? X++ R+ !tv b+++>++++ DI+++ D--- G+++>+++++ e+++>++++ h* r++>+++ y++ ------END GEEK CODE BLOCK------ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.