Return the filename associated with the payload if present. The filename is extracted from the Content-Disposition header's 'filename' parameter, and it is unquoted. If that header is missing the 'filename' parameter, this method falls back to looking for the 'name'
(self, failobj=None)
| 848 | self.set_param(p, v, header, requote) |
| 849 | |
| 850 | def get_filename(self, failobj=None): |
| 851 | """Return the filename associated with the payload if present. |
| 852 | |
| 853 | The filename is extracted from the Content-Disposition header's |
| 854 | 'filename' parameter, and it is unquoted. If that header is missing |
| 855 | the 'filename' parameter, this method falls back to looking for the |
| 856 | 'name' parameter. |
| 857 | """ |
| 858 | missing = object() |
| 859 | filename = self.get_param('filename', missing, 'content-disposition') |
| 860 | if filename is missing: |
| 861 | filename = self.get_param('name', missing, 'content-type') |
| 862 | if filename is missing: |
| 863 | return failobj |
| 864 | return utils.collapse_rfc2231_value(filename).strip() |
| 865 | |
| 866 | def get_boundary(self, failobj=None): |
| 867 | """Return the boundary associated with the payload if present. |