say you have a vars.file_name that contains the file to be uploaded. Before 
the insert you need to do (I think):

vars.file_name = 
db.UPLOAD.file_name.store(vars.file_name.file,filename=ars.file_name.filename)

Perhaps this can be automated a little but. Let me give it some thought. 
Please open an issue on google code.


On Friday, 6 April 2012 09:43:40 UTC-5, rdodev wrote:
>
> I already searched thought this groups for uploads and found a bunch 
> similar questions, but not exactly my case -- I apologize if this has been 
> answered before.
>
> I have a minimal RESTful web service defined as follows:
>
> db.define_table('UPLOAD',
>     Field('custom_name' ,type='string',  length=40, required=True),
>     Field('file_name',  type='upload', required=True),
> )
>
> @request.restful()
> def index():
> def GET(upload_id=None):
> if not upload_id:
> form = SQLFORM(db. UPLOAD )
> response.view = 'default/index.html'
> return dict(form=form)
>                 else: 
>                        ...
>  def POST(*args,**vars):
> return db.UPLOAD.validate_and_insert(**vars)
>
> return locals()
>
> when it posts, it does insert the file and and custom name, but it does 
> not actually save the file to disk (or anywhere for that matter). Am I 
> missing a step somewhere? Thanks.
>

Reply via email to