see http://web2py.com/books/default/chapter/29/07/forms-
and-validators#SQLFORM-and-uploads
just send the file in a HTTP POST (multipart encoded) from the client
Code to do it is similar to this...
@request.restful()
def uploader():
def POST(*args, **kwargs):
# if the post is correct only first item is needed
uploaded_file = kwargs[kwargs.keys()[0]]
# fake table to use readymade code for upload
db.define_table('media_content_', Field('bdata', 'upload'),
migrate=False)
filename = db.media_content_.bdata.store(uploaded_file,
uploaded_file.filename)
return dict(message='uploaded to file: {}'.format(filename))
2017-10-19 8:03 GMT+02:00 Sharjeel Ali Shaukat <[email protected]>:
> But how can i send a file for uploading
>
>
> On Thursday, October 19, 2017 at 9:46:47 AM UTC+5, Sharjeel Ali Shaukat
> wrote:
>>
>> I want to create a restful api through which i can upload files to web2py
>> application using android or other 3rd party applications. Any useful link
>> or code would be very helpful
>>
> --
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.