| 845 | return [body] |
| 846 | |
| 847 | def get_files_page(self, req): |
| 848 | file_parts = [] |
| 849 | uploaded_files = [(k, v) for k, v in req.POST.items() if 'file' in k] |
| 850 | for name, uploaded_file in uploaded_files: |
| 851 | if isinstance(uploaded_file, cgi.FieldStorage): |
| 852 | filename = to_bytes(uploaded_file.filename) |
| 853 | value = to_bytes(uploaded_file.value, 'ascii') |
| 854 | content_type = to_bytes(uploaded_file.type, 'ascii') |
| 855 | else: |
| 856 | filename = value = content_type = b'' |
| 857 | file_parts.append(b""" |
| 858 | <p>You selected '""" + filename + b"""'</p> |
| 859 | <p>with contents: '""" + value + b"""'</p> |
| 860 | <p>with content type: '""" + content_type + b"""'</p> |
| 861 | """) |
| 862 | return b''.join(file_parts) |
| 863 | |
| 864 | |
| 865 | class UploadBinaryApp(SingleUploadFileApp): |