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:
parent
5c346840bb
commit
a4d773b580
|
@ -65,10 +65,7 @@ def encode_multipart(boundary, data):
|
||||||
if isinstance(value, file):
|
if isinstance(value, file):
|
||||||
lines.extend([
|
lines.extend([
|
||||||
'--' + boundary,
|
'--' + boundary,
|
||||||
'Content-Disposition: form-data; name="%s"' % key,
|
'Content-Disposition: form-data; name="%s"; filename="%s"' % (key, value.name),
|
||||||
'',
|
|
||||||
'--' + boundary,
|
|
||||||
'Content-Disposition: form-data; name="%s_file"; filename="%s"' % (key, value.name),
|
|
||||||
'Content-Type: application/octet-stream',
|
'Content-Type: application/octet-stream',
|
||||||
'',
|
'',
|
||||||
value.read()
|
value.read()
|
||||||
|
@ -251,4 +248,4 @@ class Client:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue