---
title: suggestedFilename
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/urlresponse/suggestedfilename
---

# suggestedFilename

A suggested filename for the response data.

## Declaration

```swift
var suggestedFilename: String? { get }
```

## Discussion

Discussion Accessing this property attempts to generate a filename using the following information, in order: A filename specified using the content disposition header. The last path component of the URL. The host of the URL. If the host of URL can’t be converted to a valid filename, the filename “unknown” is used. In most cases, this property appends the proper file extension based on the MIME type. Accessing this property always returns a valid filename regardless of whether the resource is saved to disk.

## See Also

### Getting the response properties

- [expectedContentLength](foundation/urlresponse/expectedcontentlength.md)
- [mimeType](foundation/urlresponse/mimetype.md)
- [textEncodingName](foundation/urlresponse/textencodingname.md)
- [url](foundation/urlresponse/url.md)
