---
title: "uploadTask(withResumeData:completionHandler:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/urlsession/uploadtask(withresumedata:completionhandler:)"
---

# uploadTask(withResumeData:completionHandler:)

Creates a URLSessionUploadTask from a resume data blob. If resuming from an upload file, the file must still exist and be unmodified.

## Declaration

```swift
func uploadTask(withResumeData resumeData: Data, completionHandler: @escaping @Sendable (Data?, URLResponse?, (any Error)?) -> Void) -> URLSessionUploadTask
```

## Parameters

- `resumeData`: Resume data blob from an incomplete upload, such as data returned by the cancelByProducingResumeData: method.
- `completionHandler`: The completion handler to call when the load request is complete.

## Return Value

Return Value A new session upload task, or nil if the resumeData is invalid.

## See Also

### Adding upload tasks to a session

- [Building a resumable upload server with SwiftNIO](foundation/building-a-resumable-upload-server-with-swiftnio.md)
- [uploadTask(with:from:)](foundation/urlsession/uploadtask(with:from:).md)
- [uploadTask(with:from:completionHandler:)](foundation/urlsession/uploadtask(with:from:completionhandler:).md)
- [uploadTask(with:fromFile:)](foundation/urlsession/uploadtask(with:fromfile:).md)
- [uploadTask(with:fromFile:completionHandler:)](foundation/urlsession/uploadtask(with:fromfile:completionhandler:).md)
- [uploadTask(withStreamedRequest:)](foundation/urlsession/uploadtask(withstreamedrequest:).md)
- [uploadTask(withResumeData:)](foundation/urlsession/uploadtask(withresumedata:).md)
- [URLSessionUploadTask](foundation/urlsessionuploadtask.md)
- [URLSessionDataDelegate](foundation/urlsessiondatadelegate.md)
