Fixed a bug in the way file uploads were constructed. The new behaviour

should emulate a form upload more accurately.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5465 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2007-06-11 20:03:07 +00:00
parent 5c346840bb
commit a4d773b580
1 changed files with 2 additions and 5 deletions

View File

@ -65,10 +65,7 @@ def encode_multipart(boundary, data):
if isinstance(value, file):
lines.extend([
'--' + boundary,
'Content-Disposition: form-data; name="%s"' % key,
'',
'--' + boundary,
'Content-Disposition: form-data; name="%s_file"; filename="%s"' % (key, value.name),
'Content-Disposition: form-data; name="%s"; filename="%s"' % (key, value.name),
'Content-Type: application/octet-stream',
'',
value.read()