Hey folks,

I'm attempting to upload a file directly without the use of a SQLForm but 
rather the ordinary FORM.
>From previous threads regarding the topic i figured my controller should 
look something like this:

[code]
def index():
    
    import shutil 
    form = FORM( 
            INPUT( _name="upload", _type="file"),
        INPUT( _type="Submit", _value="Upload" ))
    if form.accepts(request,session):
        if form.vars: 
         
           filename=request.vars.upload.filename
           file=request.vars.upload.file
           shutil.copyfileobj(file,open('/path'+filename,'wb')) 
    return dict (form = form)
[/code]

yet no file appears in the folder of my path. I'm not sure if the problem 
is with my code or maybe elsewhere, for example permission based. I'm using 
a raspberry with a raspiban os. i Already tried to start python as root 
user. 

Can someone spot a mistake in the code? has someone tried to run this on a 
debian based os and knows if its a permission problem? I'm aware of the 
potential dangers of the shutil.copyfileobj, so no worries about that.

Sincerely,

-- 
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.

Reply via email to