Fixed #192 -- File uploads now work with built-in Web server. Thanks, mordaha@gmail.com

git-svn-id: http://code.djangoproject.com/svn/django/trunk@476 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-08-10 21:20:45 +00:00
parent 7bb1a2bbba
commit 77d20bedd4
1 changed files with 1 additions and 0 deletions

View File

@ -29,6 +29,7 @@ class WSGIRequest(httpwrappers.HttpRequest):
post_data = self.environ['wsgi.input'].read(int(self.environ["CONTENT_LENGTH"])) post_data = self.environ['wsgi.input'].read(int(self.environ["CONTENT_LENGTH"]))
if self.environ.get('CONTENT_TYPE', '').startswith('multipart'): if self.environ.get('CONTENT_TYPE', '').startswith('multipart'):
header_dict = dict([(k, v) for k, v in self.environ.items() if k.startswith('HTTP_')]) header_dict = dict([(k, v) for k, v in self.environ.items() if k.startswith('HTTP_')])
header_dict['Content-Type'] = self.environ.get('CONTENT_TYPE', '')
self._post, self._files = httpwrappers.parse_file_upload(header_dict, post_data) self._post, self._files = httpwrappers.parse_file_upload(header_dict, post_data)
else: else:
self._post, self._files = httpwrappers.QueryDict(post_data), datastructures.MultiValueDict() self._post, self._files = httpwrappers.QueryDict(post_data), datastructures.MultiValueDict()