Hi
I am a newbie to web2py and I'm just learning. I am trying to implement
Multiupload in my code as suggested on this
thread https://groups.google.com/forum/#!topic/web2py/XpnUb2_MaRc
I am getting an error "*[Errno 21] is a directory*" while specifying the
upload directory in my db.py model. I am stuck at this for many hours, can
someone please help. I am copy pasting my table below. Below it is the
table which works perfectly fine although the upload folder is the same.
Any help of lead would be highly appreciated! Thanks a lot :)
db.define_table('newsfeed',
Field
<http://127.0.0.1:8000/examples/global/vars/Field>('body','text',represent=lambda
text, row: XML
<http://127.0.0.1:8000/examples/global/vars/XML>(text.replace('\n', '<br />'))),
Field
<http://127.0.0.1:8000/examples/global/vars/Field>('imFlag','boolean',readable=False,
writable=False, default=False),
Field <http://127.0.0.1:8000/examples/global/vars/Field>('image',
'upload', uploadfolder="../uploads/", notnull=False, # notnull=False is required
label=T <http://127.0.0.1:8000/examples/global/vars/T>('Image'),
represent = lambda x, row: CAT
<http://127.0.0.1:8000/examples/global/vars/CAT>(A
<http://127.0.0.1:8000/examples/global/vars/A>(IMG
<http://127.0.0.1:8000/examples/global/vars/IMG>(_src=URL
<http://127.0.0.1:8000/examples/global/vars/URL>('static','uploads/%s'%x),
_style='width:50px;height:50px;border:0;'),
_style='display:block;width:50px;height:50px;padding:3px;background:#fc0;text-decoration:none;',
_title='click to
enlarge',**{'_href':"#pic%s"%row.id,'_data-toggle':"modal"}),
DIV
<http://127.0.0.1:8000/examples/global/vars/DIV>(SPAN
<http://127.0.0.1:8000/examples/global/vars/SPAN>('%s
[%s]'%(row.body,db.newsfeed.image.retrieve(x)[0])),TAG
<http://127.0.0.1:8000/examples/global/vars/TAG>.BUTTON(XML
<http://127.0.0.1:8000/examples/global/vars/XML>('×'), _class="close",
_style='display:block;margin:0 5px 9px 0;', **{'_data-dismiss':"modal"}),
DIV
<http://127.0.0.1:8000/examples/global/vars/DIV>(IMG
<http://127.0.0.1:8000/examples/global/vars/IMG>(_src=URL
<http://127.0.0.1:8000/examples/global/vars/URL>('static','uploads/%s'%x))),
_class="modal hide
fade",
_id="pic%s"%row.id,
_style="width:auto;height:auto;padding:5px;top:33%;"))
or ''
),
#Field('image', 'upload',uploadfolder="../uploads/"),
Field
<http://127.0.0.1:8000/examples/global/vars/Field>('vidFlag','boolean',readable=False,
writable=False, default=False),
Field
<http://127.0.0.1:8000/examples/global/vars/Field>('dmFlag','boolean',readable=False,
writable=False, default=False),
Field
<http://127.0.0.1:8000/examples/global/vars/Field>('youtube_url','text',
label='Video Link'),
Field <http://127.0.0.1:8000/examples/global/vars/Field>('share_with',
requires = IS_IN_SET
<http://127.0.0.1:8000/examples/global/vars/IS_IN_SET>(["Everyone","Only my
network", "Connections of Connections"], zero=T
<http://127.0.0.1:8000/examples/global/vars/T>('Choose One'))),
#Field('thumbnail','upload', readable=False, writable=False),
Field <http://127.0.0.1:8000/examples/global/vars/Field>('created_by',
'reference auth_user', readable=False, writable=False, default=auth.user_id),
Field <http://127.0.0.1:8000/examples/global/vars/Field>('created_on',
'datetime',readable=False, writable=False, default=request
<http://127.0.0.1:8000/examples/global/vars/request>.now),
Field
<http://127.0.0.1:8000/examples/global/vars/Field>('likes','integer',readable=False,
writable=False, default=0))
At the same time the following code works perfectly fine:
db.define_table('newsfeed',
Field
<http://127.0.0.1:8000/examples/global/vars/Field>('body','text',represent=lambda
text, row: XML
<http://127.0.0.1:8000/examples/global/vars/XML>(text.replace('\n', '<br />'))),
Field
<http://127.0.0.1:8000/examples/global/vars/Field>('imFlag','boolean',readable=False,
writable=False, default=False),
Field <http://127.0.0.1:8000/examples/global/vars/Field>('image',
'upload',uploadfolder="../uploads/"),
Field
<http://127.0.0.1:8000/examples/global/vars/Field>('vidFlag','boolean',readable=False,
writable=False, default=False),
Field
<http://127.0.0.1:8000/examples/global/vars/Field>('dmFlag','boolean',readable=False,
writable=False, default=False),
Field
<http://127.0.0.1:8000/examples/global/vars/Field>('youtube_url','text',
label='Video Link'),
Field <http://127.0.0.1:8000/examples/global/vars/Field>('share_with',
requires = IS_IN_SET
<http://127.0.0.1:8000/examples/global/vars/IS_IN_SET>(["Everyone","Only my
network", "Connections of Connections"], zero=T
<http://127.0.0.1:8000/examples/global/vars/T>('Choose One'))),
#Field('thumbnail','upload', readable=False, writable=False),
Field <http://127.0.0.1:8000/examples/global/vars/Field>('created_by',
'reference auth_user', readable=False, writable=False, default=auth.user_id),
Field <http://127.0.0.1:8000/examples/global/vars/Field>('created_on',
'datetime',readable=False, writable=False, default=request
<http://127.0.0.1:8000/examples/global/vars/request>.now),
Field
<http://127.0.0.1:8000/examples/global/vars/Field>('likes','integer',readable=False,
writable=False, default=0))
--
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/groups/opt_out.