PHP CURL .FILE output issue

Hi everyone,

I am trying to use the “Generated PHP CURL” code via Postman

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://drop.cx/upload/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "<file contents here>",
  CURLOPT_HTTPHEADER => array(
    "Linx-Expiry: 0",
    "Accept:  application/json",
    "Linx-Randomize: Yes",
    "Content-Type: image/png"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

The output is this => http://drop.cx/dl/9wodt4ho.png (.PNG)

{
    "access_key": "",
    "delete_key": "knWaQ4X79698OOtN0f78MYKXLddJhb",
    "direct_url": "http://drop.cx/dl/9wodt4ho.png",
    "expiry": "1624125905",
    "filename": "9wodt4ho.png",
    "mimetype": "image/png",
    "sha256sum": "b2d0c95a6506ab3a847a587ff5231689980ebd8d315e01d4a127e6ff2bf4b564",
    "size": "2866",
    "url": "http://drop.cx/9wodt4ho.png"
}

But when I try the generated code on my server using the same code

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://drop.cx/upload/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => **"m.png",** _//file name within the folder_
  CURLOPT_HTTPHEADER => array(
    "Linx-Expiry: 0",
    "Accept:  application/json",
    "Linx-Randomize: Yes",
    "Content-Type: video/mp4"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

The output is this => http://drop.cx/dl/03lwsz63.file (.FILE)

{
  "access_key": "",
  "delete_key": "Rq1ZECOdkhhNDdNkMeIbetggy5BQ6g",
  "direct_url": "http://drop.cx/dl/03lwsz63.file",
  "expiry": "1624126372",
  "filename": "03lwsz63.file",
  "mimetype": "text/plain",
  "sha256sum": "1d3928d937bc79ee33b20a6d9fc7125124895d179925133814d03ad6ef450434",
  "size": "5",
  "url": "http://drop.cx/03lwsz63.file"
}

Both used the same generated code but the last one will output a “.file” extension.