upload zip file using REST API in R Programming

I have zip file which contain folders and inside those folders - files are there. Through POSTMAN zip file gets uploaded in milliseconds. In Body for Postman - "form-data"

But same thing I am trying to execute using R programming httr::PUT request, I am getting below error:
Error in curl::curl_fetch_memory(url, handle = handle) : transfer closed with 163 bytes remaining to read

Could you please suggest what I am missing in below code or where I am going wrong.

localFilePath <-
paste0(getwd(), "/TestFolder_2020-04-02 19-28.zip")

upload.response <-
httr::PUT(
URLencode(
  "https://API/UUID/Shapes"
),
add_headers(
  .headers = c("Token" = "*************",
               "Content-Type" = "application/json")
),
body = list(uploadFile = upload_file(localFilePath)),
encode = "multipart"
)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.