summaryrefslogtreecommitdiff
path: root/django/core/files/uploadedfile.py
Commit message (Collapse)AuthorAgeFilesLines
* Refs #33476 -- Reformatted code with Black.django-bot2022-02-071-12/+42
|
* Fixed CVE-2021-31542 -- Tightened path & file name sanitation in file uploads.Florian Apolloner2021-05-041-0/+3
|
* Removed redundant UploadedFile.DEFAULT_CHUNK_SIZE.Sergey Fedoseev2018-03-121-1/+0
| | | The same value is inherited from File.
* Fixed #28776 -- Fixed a/an/and typos in docs and comments.Дилян Палаузов2017-11-061-1/+1
|
* Fixed #26651 -- Kept original file suffix in TemporaryUploadedFile nameClaude Paroz2017-06-051-1/+2
| | | | Thanks Tim Graham for the review.
* Fixed #27777 -- Made File.open() work with the with statement (#8310)Ingo Klöcker2017-04-071-0/+1
| | | Fixed #27777 -- Made File.open() work with the with statement
* Refs #27656 -- Updated django.core docstring verbs according to PEP 257.Anton Samarchyan2017-02-211-5/+2
|
* Refs #23919 -- Replaced super(ClassName, self) with super().chillaranand2017-01-251-5/+4
|
* Refs #23919 -- Replaced errno checking with PEP 3151 exceptions.Tim Graham2017-01-251-7/+5
|
* Refs #23919 -- Removed unneeded force_str callsClaude Paroz2017-01-201-3/+1
|
* Removed unnecessary check in TemporaryUploadedFile.Jon Dufresne2016-06-111-4/+1
| | | | If settings.FILE_UPLOAD_TEMP_DIR is the default value of None, NamedTemporaryFile will work the same as if nothing was passed.
* Fixed E128 flake8 warnings in django/.Tim Graham2016-04-081-2/+1
|
* Sorted imports with isort; refs #23860.Tim Graham2015-02-061-1/+1
|
* Fixed #22680 -- I/O operation on closed file.Florian Apolloner2014-06-111-3/+0
| | | | | | | This patch is two-fold; first it ensure that Django does close everything in request.FILES at the end of the request and secondly the storage system should no longer close any files during save, it's up to the caller to handle that -- or let Django close the files at the end of the request.
* Made content_type_extra optional for TemporaryUploadedFile and ↵Dmitro2014-02-181-2/+2
| | | | | | | | | MemoryUploadedFile. This provides better backwards compatibility for those constructing these objects manually. Refs #13721.
* Use `classmethod` as a decorator.xuxiang2013-11-191-1/+1
|
* Fixed all E226 violationsAlex Gaynor2013-11-031-1/+1
|
* Replaced a hardcoded "2" with the right named constantAlex Gaynor2013-11-021-1/+5
|
* Fixed #21033 -- Fixed uploaded filenames not always being truncated to 255 ↵homm2013-09-101-0/+1
| | | | characters
* Fixed #13721 -- Added UploadedFile.content_type_extra.Benjamin Kagia2013-07-111-6/+7
| | | | Thanks Waldemar Kornewald and mvschaik for work on the patch.
* Replaced some smart_xxx by force_xxx equivalentClaude Paroz2012-08-301-2/+2
| | | | | smart_str/smart_text should only be used when a potential lazy string should be preserved in the result of the function call.
* [py3] Made __repr__ return str with Python 3Claude Paroz2012-08-121-2/+2
|
* [py3] Ported django.utils.encoding.Aymeric Augustin2012-08-071-2/+2
| | | | | | | | | | | * Renamed smart_unicode to smart_text (but kept the old name under Python 2 for backwards compatibility). * Renamed smart_str to smart_bytes. * Re-introduced smart_str as an alias for smart_text under Python 3 and smart_bytes under Python 2 (which is backwards compatible). Thus smart_str always returns a str objects. * Used the new smart_str in a few places where both Python 2 and 3 want a str.
* Marked bytestrings with b prefix. Refs #18269Claude Paroz2012-05-191-2/+2
| | | | | This is a preparation for unicode literals general usage in Django (Python 3 compatibility).
* Replaced cStringIO.StringIO by io.BytesIO.Claude Paroz2012-05-051-6/+3
| | | | | Also replaced StringIO.StringIO by BytesIO in some other appropriate places. StringIO is not available in Python 3.
* Fixed #18013 -- Use the new 'as' syntax for exceptions.Claude Paroz2012-04-291-1/+1
| | | | | Thanks Clueless for the initial patch. Note that unittest has been purposely left out (external package only used by Python 2.6).
* Fixed #10404: ImageField height_field and width_field options no longer ↵Jacob Kaplan-Moss2009-05-111-12/+11
| | | | | | | | | | | | | | | | depend on putting the image field after the height/width fields as they did after r9766. This bug actually exposed a related handful of inconsistancies in the underlying file handling and wraping, so a few related changes are in here as well: * Dimensions are also now calculated the moment the image is assigned to the field instead of upon save. * The base `File` object now when possible delegates its closed attribute down to the os-level file it wrapps. * In-memory files' `close()` now is a no-op. Without this certain APIs that should be able to handle in-memory files were failing. * Accessing `FieldFile.closed` used to open the file. That's silly, and it doesn't any more. * Some over-eager error handling was squishing some errors that would normally be raised. One unit test was incorrectly depending on this behavior, so the test was removed. Thanks to Armin Ronacher for much of this work. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10737 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed #7712, #9404, #10249, #10300: a light refactor and cleanup of file ↵Jacob Kaplan-Moss2009-05-081-56/+27
| | | | | | storage and the `File` object. Thanks to Armin Ronacher and Alex Gaynor. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10717 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* FIxed #8156: `UploadedFile.__repr__` now returns a string, a good `__repr__` ↵Jacob Kaplan-Moss2008-08-271-1/+2
| | | | | | should. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8636 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed #7769: Added a couple missing file methods to `TemporaryUploadedFile`. ↵Jacob Kaplan-Moss2008-08-271-13/+14
| | | | | | Thanks, Mads Sülau Jørgensen. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8634 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed #7830 -- Removed all of the remaining, deprecated, non-oldforms features:Gary Wilson Jr2008-08-101-66/+5
| | | | | | | | | | | | | | | * Support for representing files as strings was removed. Use `django.core.files.base.ContentFile` instead. * Support for representing uploaded files as dictionaries was removed. Use `django.core.files.uploadedfile.SimpleUploadedFile` instead. * The `filename`, `file_name`, `file_size`, and `chuck` properties of `UploadedFile` were removed. Use the `name`, `name`, `size`, and `chunks` properties instead, respectively. * The `get_FIELD_filename`, `get_FIELD_url`, `get_FIELD_size`, and `save_FIELD_file` methods for Models with `FileField` fields were removed. Instead, use the `path`, `url`, and `size` attributes and `save` method on the field itself, respectively. * The `get_FIELD_width` and `get_FIELD_height` methods for Models with `ImageField` fields were removed. Use the `width` and `height` attributes on the field itself instead. * The dispatcher `connect`, `disconnect`, `send`, and `sendExact` functions were removed. Use the signal object's own `connect`, `disconnect`, `send`, and `send` methods instead, respectively. * The `form_for_model` and `form_for_instance` functions were removed. Use a `ModelForm` subclass instead. * Support for importing `django.newforms` was removed. Use `django.forms` instead. * Support for importing `django.utils.images` was removed. Use `django.core.files.images` instead. * Support for the `follow` argument in the `create_object` and `update_object` generic views was removed. Use the `django.forms` package and the new `form_class` argument instead. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8291 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* File storage refactoring, adding far more flexibility to Django's file ↵Jacob Kaplan-Moss2008-08-081-57/+2
| | | | | | | | | | | | | handling. The new files.txt document has details of the new features. This is a backwards-incompatible change; consult BackwardsIncompatibleChanges for details. Fixes #3567, #3621, #4345, #5361, #5655, #7415. Many thanks to Marty Alchin who did the vast majority of this work. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8244 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed #7683: Try not to delete uploaded files before moving them, and don't ↵Jacob Kaplan-Moss2008-08-051-2/+12
| | | | | | wig out of someone else does. Patch from screeley and spaetz. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8217 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed #7658 -- Added some Windows-specific tempfile handling. The standardMalcolm Tredinnick2008-07-261-1/+2
| | | | | | | | stuff doesn't work with the way Django's file uploading code wants to operate. Patch from Mike Axiak. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8096 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed #7675: corrected TemporaryUploadedFile.temporary_file_path. Thanks, ↵Jacob Kaplan-Moss2008-07-121-1/+1
| | | | | | Florian Apolloner. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7908 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed deprecated UploadedFile.data attribute. Refs #7614.Jacob Kaplan-Moss2008-07-071-1/+9
| | | | git-svn-id: http://code.djangoproject.com/svn/django/trunk@7861 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Added a missing deprecated property (UploadedFile.filename) from [7859]. ↵Jacob Kaplan-Moss2008-07-071-0/+1
| | | | | | Refs #7614. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7860 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed #7614: the quickening has come, and there now is only one ↵Jacob Kaplan-Moss2008-07-071-43/+105
| | | | | | | | | | | | | UploadedFile. On top of that, UploadedFile's interface has been improved: * The API now more closely matches a proper file API. This unfortunately means a few backwards-incompatible renamings; see BackwardsIncompatibleChanges. This refs #7593. * While we were at it, renamed chunk() to chunks() to clarify that it's an iterator. * Temporary uploaded files now property use the tempfile library behind the scenes which should ensure better cleanup of tempfiles (refs #7593 again). Thanks to Mike Axiak for the bulk of this patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7859 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Corrected typo in `uploadedfile` module.Gary Wilson Jr2008-07-031-1/+1
| | | | git-svn-id: http://code.djangoproject.com/svn/django/trunk@7829 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Oops, missed a changed file in [7817].Jacob Kaplan-Moss2008-07-011-2/+2
| | | | git-svn-id: http://code.djangoproject.com/svn/django/trunk@7818 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed #2070: refactored Django's file upload capabilities.Jacob Kaplan-Moss2008-07-011-0/+190
A description of the new features can be found in the new [http://www.djangoproject.com/documentation/upload_handing/ upload handling documentation]; the executive summary is that Django will now happily handle uploads of large files without issues. This changes the representation of uploaded files from dictionaries to bona fide objects; see BackwardsIncompatibleChanges for details. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7814 bcc190cf-cafb-0310-a4f2-bffc1f526a37