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

# uploadTask(withResumeData:)

Creates an upload task from a resume data blob. Requires the server to support the latest resumable uploads Internet-Draft from the HTTP Working Group, found at https://datatracker.ietf.org/doc/draft-ietf-httpbis-resumable-upload/ If resuming from an upload file, the file must still exist and be unmodified. If the upload cannot be successfully resumed, URLSession:task:didCompleteWithError: will be called.

## Declaration

```swift
func uploadTask(withResumeData resumeData: Data) -> URLSessionUploadTask
```

## Parameters

- `resumeData`: Resume data blob from an incomplete upload, such as data returned by the cancelByProducingResumeData: method.

## Mentioned in

Pausing and resuming uploads

## 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:completionHandler:)](foundation/urlsession/uploadtask(withresumedata:completionhandler:).md)
- [URLSessionUploadTask](foundation/urlsessionuploadtask.md)
- [URLSessionDataDelegate](foundation/urlsessiondatadelegate.md)
