> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://uploadcare.com/docs/llms.txt.

# Upload individual file parts

PUT https://upload.uploadcare.com/<presigned-url-x>
Content-Type: application/octet-stream

The second phase is about uploading the file parts to the presigned upload URLs returned from the
`/multipart/start/` endpoint.

Each uploaded part should be at least 5 MiB (5242880 bytes) in size except for the last one, which can be smaller.
You can upload the file parts in parallel provided that the byte order stays unchanged.

**Note**: You MUST define `Content-Type` header for your data.


Reference: https://uploadcare.com/docs/api/upload/upload/multipart-file-upload-part

## Request

### Body (application/octet-stream)

This endpoint expects binary data of type application/octet-stream.

- Binary request body.

## Examples

**SDK Code**

```javascript JS
import { multipartUpload } from '@uploadcare/upload-client'

// partData is a chunk of the uploaded file's content
// must be `Blob` or `File` or `Buffer`
const result = await multipartUpload(
  partData,
  '<presigned-url-x>'
)

```

```php PHP
// Uploadcare lib provides high level API for multipart uploads that does everything for you

<?php
$configuration = Uploadcare\Configuration::create((string) $_ENV['UPLOADCARE_PUBLIC_KEY'], (string) $_ENV['UPLOADCARE_SECRET_KEY']);

$uploader = new Uploadcare\Uploader\Uploader($configuration);
$path = '/path-to-large-file.zip';
$handle = \fopen($path, 'rb');
$response = $uploader->fromResource($handle, null, null, 'auto', [
    'size' => \filesize($path), // The "size" is the metadata key
]);
echo \sprintf('File uploaded. ID is \'%s\'', $response->getUuid());

```

```python Python
// Uploadcare lib provides high level API for multipart uploads that does everything for you

from pyuploadcare import Uploadcare, File

uploadcare = Uploadcare(public_key='YOUR_PUBLIC_KEY', secret_key='YOUR_SECRET_KEY')
with open('test1.txt', 'rb') as file_object:
    ucare_file = uploadcare.multipart_upload(file_object)

```

```ruby Ruby
// Uploadcare lib provides high level API for multipart uploads that does everything for you

require 'uploadcare'
Uploadcare.config.public_key = 'YOUR_PUBLIC_KEY'
Uploadcare.config.secret_key = 'YOUR_SECRET_KEY'

source_file = File.open('image.png')
Uploadcare::Uploader.upload(source_file, store: 'auto')

```

```swift Swift
// Uploadcare lib provides high level API for multipart uploads that does everything for you

import Uploadcare

let uploadcare = Uploadcare(withPublicKey: "YOUR_PUBLIC_KEY", secretKey: "YOUR_SECRET_KEY")

guard let url = Bundle.main.url(forResource: "Mona_Lisa_23mb", withExtension: "jpg"),
      let data = try? Data(contentsOf: url) else { return }

let metadata = ["subsystem": "uploader", "pet": "cat"]
let onProgress: (Double)->Void = { (progress) in
  print("progress: \(progress)")
}

let file = try await uploadcare.uploadAPI.multipartUpload(data, withName: "Mona_Lisa_big.jpg", store: .auto, metadata: metadata, onProgress)
print(file)

```

```kotlin Kotlin
// Uploadcare lib provides high level API for multipart uploads that does everything for you

import com.uploadcare.android.library.api.UploadcareClient

val uploadcare = UploadcareClient(publicKey = "YOUR_PUBLIC_KEY", secretKey = "YOUR_SECRET_KEY")

val uri = "content://com.android.providers.media.documents/document/image%3A1000001178".toUri()
val file = FileUploader(uploadcare, uri = uri, context = context).upload()
Log.d("TAG", file.toString())

```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://upload.uploadcare.com/%3Cpresigned-url-x%3E"

	req, _ := http.NewRequest("PUT", url, nil)

	req.Header.Add("Content-Type", "application/octet-stream")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://upload.uploadcare.com/%3Cpresigned-url-x%3E")
  .header("Content-Type", "application/octet-stream")
  .asString();
```

```csharp
using RestSharp;

var client = new RestClient("https://upload.uploadcare.com/%3Cpresigned-url-x%3E");
var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "application/octet-stream");
IRestResponse response = client.Execute(request);
```