When uploading only one file, there is no problem, but when I try to
upload more
than one file in the same form, I got error. The code is like the
following:
<form method="post" action="/admin/new" enctype="multipart/form-data">
<input type="file" name="file1" />
<input type="file" name="file2" />
<input type="file" name="file3" />
</form>
and in python code I use exactly as in the cookbook:
>>> i = web.input(file1={}, file2={}, file3={})
>>> file('output', 'w').write(i.file1.file.read())
>>> ...
If I do the same thing with just ONE file everything works well, but
for 2 or more I got the
following error, and the application freezes:
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/web.py-0.31-py2.5.egg/web/
application.p
y", line 209, in process
return p(lambda: process(processors))
File "/usr/lib/python2.5/site-packages/web.py-0.31-py2.5.egg/web/
application.p
y", line 537, in processor
return handler()
File "/usr/lib/python2.5/site-packages/web.py-0.31-py2.5.egg/web/
application.p
y", line 209, in <lambda>
return p(lambda: process(processors))
File "/usr/lib/python2.5/site-packages/web.py-0.31-py2.5.egg/web/
application.p
y", line 216, in process
raise self.internalerror()
File "/usr/lib/python2.5/site-packages/web.py-0.31-py2.5.egg/web/
application.p
y", line 449, in internalerror
return debugerror.debugerror()
File "/usr/lib/python2.5/site-packages/web.py-0.31-py2.5.egg/web/
debugerror.py
", line 299, in debugerror
return web._InternalError(djangoerror())
File "/usr/lib/python2.5/site-packages/web.py-0.31-py2.5.egg/web/
debugerror.py
", line 289, in djangoerror
return t(exception_type, exception_value, frames)
File "/usr/lib/python2.5/site-packages/web.py-0.31-py2.5.egg/web/
template.py",
line 850, in __call__
return BaseTemplate.__call__(self, *a, **kw)
File "/usr/lib/python2.5/site-packages/web.py-0.31-py2.5.egg/web/
template.py",
line 768, in __call__
return self._join_output(out)
File "/usr/lib/python2.5/site-packages/web.py-0.31-py2.5.egg/web/
template.py",
line 774, in _join_output
for name, value in out:
File "/usr/lib/python2.5/site-packages/web.py-0.31-py2.5.egg/web/
debugerror.py
c", line 183, in __template__
$if ctx.output or ctx.headers:
File "/usr/lib/python2.5/site-packages/web.py-0.31-py2.5.egg/web/
webapi.py", l
ine 222, in input
return storify(out, *requireds, **defaults)
File "/usr/lib/python2.5/site-packages/web.py-0.31-py2.5.egg/web/
utils.py", li
ne 141, in storify
value = getvalue(value)
File "/usr/lib/python2.5/site-packages/web.py-0.31-py2.5.egg/web/
utils.py", li
ne 128, in getvalue
return unicodify(x.value)
File "/usr/lib/python2.5/site-packages/web.py-0.31-py2.5.egg/web/
utils.py", li
ne 123, in unicodify
if _unicode and isinstance(s, str): return safeunicode(s)
File "/usr/lib/python2.5/site-packages/web.py-0.31-py2.5.egg/web/
utils.py", li
ne 231, in safeunicode
return obj.decode(encoding)
File "/usr/lib/python2.5/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 0:
unexpecte
d code byte
Does anyone know why this happens?
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---