MCPcopy
hub / github.com/django/django / file_upload_view

Function file_upload_view

tests/file_uploads/views.py:18–33  ·  view source on GitHub ↗

A file upload can be updated into the POST dictionary.

(request)

Source from the content-addressed store, hash-verified

16
17
18def 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
36def file_upload_view_verify(request):

Callers

nothing calls this directly

Calls 5

HttpResponseClass · 0.90
copyMethod · 0.45
updateMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected