> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/switch-infrastructure/config-manager/llms.txt.
> For full documentation content, see https://docs.nvidia.com/switch-infrastructure/config-manager/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/switch-infrastructure/config-manager/_mcp/server.

# Upload File

POST https://host.com/v1/files/{platform}/{version}/{filename}
Content-Type: multipart/form-data

Upload a file to the storage backend.

Set ``firmware_image=true`` to tag this file as the OS/firmware image for
the given platform and version. Only one firmware image is allowed per
platform/version directory; the upload will be rejected if a *different*
file already occupies that slot.

Reference: https://docs.nvidia.com/switch-infrastructure/config-manager/switch-infrastructure/config-manager/services/network-ztp/ztp-api/files/upload-file-v-1-files-platform-version-filename-post

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: ztp-api
  version: 1.0.0
paths:
  /v1/files/{platform}/{version}/{filename}:
    post:
      operationId: upload-file-v-1-files-platform-version-filename-post
      summary: Upload File
      description: >-
        Upload a file to the storage backend.


        Set ``firmware_image=true`` to tag this file as the OS/firmware image
        for

        the given platform and version. Only one firmware image is allowed per

        platform/version directory; the upload will be rejected if a *different*

        file already occupies that slot.
      tags:
        - subpackage_files
      parameters:
        - name: platform
          in: path
          required: true
          schema:
            type: string
        - name: version
          in: path
          required: true
          schema:
            type: string
        - name: filename
          in: path
          required: true
          schema:
            type: string
        - name: checksum
          in: query
          required: true
          schema:
            type: string
        - name: overwrite
          in: query
          required: false
          schema:
            type: boolean
            default: false
        - name: firmware_image
          in: query
          required: false
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: string
        '404':
          description: Not found
          content:
            application/json:
              schema:
                description: Any type
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
              required:
                - file
servers:
  - url: https://host.com
components:
  schemas:
    ValidationErrorCtx:
      type: object
      properties: {}
      title: ValidationErrorCtx
    ValidationErrorLocItems:
      oneOf:
        - type: string
        - type: integer
      title: ValidationErrorLocItems
    ValidationError:
      type: object
      properties:
        ctx:
          $ref: '#/components/schemas/ValidationErrorCtx'
        input:
          description: Any type
        loc:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorLocItems'
        msg:
          type: string
        type:
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
    HTTPValidationError:
      type: object
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
      title: HTTPValidationError

```

## SDK Code Examples

```python
import requests

url = "https://host.com/v1/files/platform/version/filename"

querystring = {"checksum":"checksum"}

files = { "file": "open('SGVsbG8gV29ybGQ=', 'rb')" }

response = requests.post(url, files=files, params=querystring)

print(response.json())
```

```javascript
const url = 'https://host.com/v1/files/platform/version/filename?checksum=checksum';
const form = new FormData();
form.append('file', 'SGVsbG8gV29ybGQ=');

const options = {method: 'POST'};

options.body = form;

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://host.com/v1/files/platform/version/filename?checksum=checksum"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"SGVsbG8gV29ybGQ=\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

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

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

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

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://host.com/v1/files/platform/version/filename?checksum=checksum")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"SGVsbG8gV29ybGQ=\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
```

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

HttpResponse<String> response = Unirest.post("https://host.com/v1/files/platform/version/filename?checksum=checksum")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"SGVsbG8gV29ybGQ=\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://host.com/v1/files/platform/version/filename?checksum=checksum', [
  'multipart' => [
    [
        'name' => 'file',
        'filename' => 'SGVsbG8gV29ybGQ=',
        'contents' => null
    ]
  ]
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://host.com/v1/files/platform/version/filename?checksum=checksum");
var request = new RestRequest(Method.POST);
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"SGVsbG8gV29ybGQ=\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation
let parameters = [
  [
    "name": "file",
    "fileName": "SGVsbG8gV29ybGQ="
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://host.com/v1/files/platform/version/filename?checksum=checksum")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```