[Django] #36974: SimpleUploadedFile should support text mode

1 view
Skip to first unread message

Django

unread,
Mar 6, 2026, 8:19:17 AM (23 hours ago) Mar 6
to django-...@googlegroups.com
#36974: SimpleUploadedFile should support text mode
-------------------------------------+-------------------------------------
Reporter: Denis Washington | Type:
| Uncategorized
Status: new | Component: File
| uploads/storage
Version: 6.0 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Currently, `SimpleUploadedFile` requires a bytes-like object to be passed
as `content`, and `open()` always returns a `BytesIO`. This makes it
useless in contexts where text-mode file-like object is expected. (I hit
this issue when trying to pass `file.open()` to `pandas.read_csv()`, for
instance.)

It would be great if `SimpleUploadedFile` would alternatively accept a
`str`, in which case `open()` would then return a `StringIO` instead.
--
Ticket URL: <https://code.djangoproject.com/ticket/36974>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 6, 2026, 9:26:14 PM (10 hours ago) Mar 6
to django-...@googlegroups.com
#36974: SimpleUploadedFile should support text mode
-------------------------------------+-------------------------------------
Reporter: Denis Washington | Owner: Dinesh
| Thumma
Type: Uncategorized | Status: assigned
Component: File | Version: 6.0
uploads/storage |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Dinesh Thumma):

* owner: (none) => Dinesh Thumma
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/36974#comment:1>
Reply all
Reply to author
Forward
0 new messages