| 651 | |
| 652 | == Uploaded file changes == |
| 653 | |
| 654 | [7814] introduced changes to the way Django handles uploadded files. Most of the changes are in the form of added flexibility and performance (for details, see the [http://www.djangoproject.com/documentation/upload_handing/ upload handling documentation]). |
| 655 | |
| 656 | However, as part of the change, the representation of uploaded files has changed. Previous, uploadded files -- that is, entries in {{{request.FILES}}} -- were represented by simple dictionaries with a few well-known keys. Uploaded files are now represented by an [http://www.djangoproject.com/documentation/upload_handing/#uploaded-file-objects UploadedFile object], and thus the file's information is accessible through object attributes. Thus, given {{{f = request.FILES['some_field_name']}}}: |
| 657 | |
| 658 | || '''Old''' || '''New''' || |
| 659 | || {{{f['content']}}} || {{{f.read()}}} || |
| 660 | || {{{f['filename']}}} || {{{f.file_name}}} || |
| 661 | || {{{f['content-type']}}} || {{{f.content_type}}} || |
| 662 | |
| 663 | The old dictionary-style key access is still supported, but will raise a {{{DeprecationWarning}}}. |