<!--
{
  "availability" : [
    "iOS: 18.4.0 -",
    "iPadOS: 18.4.0 -",
    "macCatalyst: 18.4.0 -",
    "macOS: 10.12.0 -",
    "visionOS: 2.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKUIDelegate/webView(_:runOpenPanelWith:initiatedByFrame:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(pl)WKUIDelegate(im)webView:runOpenPanelWithParameters:initiatedByFrame:completionHandler:"
  },
  "title" : "webView(_:runOpenPanelWith:initiatedByFrame:completionHandler:)"
}
-->

# webView(_:runOpenPanelWith:initiatedByFrame:completionHandler:)

Displays a file upload panel.

```
optional func webView(_ webView: WKWebView, runOpenPanelWith parameters: WKOpenPanelParameters, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping @MainActor @Sendable ([URL]?) -> Void)
```

## Parameters

`webView`

The web view that invokes the delegate method.

`parameters`

The parameters that describe the file upload control.

`frame`

The frame with the file upload control that initiates the call.

`completionHandler`

The completion handler the system calls after a person dismisses the open panel. Pass the selected URLs if the person selects “OK”, otherwise pass `nil`.

## Discussion

Implement this method to customize the upload panel. To disable file uploads, implement this method to return `nil`.

- By default on macOS, file uploads are disabled if you don’t implement this method.
- By default on iOS, file uploads are enabled if you don’t implement this method.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)