A file upload can be updated into the POST dictionary.
(request)
| 16 | |
| 17 | |
| 18 | def file_upload_view(request): |
| 19 | """ |
| 20 | A file upload can be updated into the POST dictionary. |
| 21 | """ |
| 22 | form_data = request.POST.copy() |
| 23 | form_data.update(request.FILES) |
| 24 | if isinstance(form_data.get("file_field"), UploadedFile) and isinstance( |
| 25 | form_data["name"], str |
| 26 | ): |
| 27 | # If a file is posted, the dummy client should only post the file name, |
| 28 | # not the full path. |
| 29 | if os.path.dirname(form_data["file_field"].name) != "": |
| 30 | return HttpResponseServerError() |
| 31 | return HttpResponse() |
| 32 | else: |
| 33 | return HttpResponseServerError() |
| 34 | |
| 35 | |
| 36 | def file_upload_view_verify(request): |
nothing calls this directly
no test coverage detected