How to fix 'CURLFile' function not found error?
<p>I am trying to implement marketo create file rest API. But i am getting 'Class CURLFile not found' error due to my php version. So please help how i can use 'CURLFile' funtion in lower php or is their any another equivalent of same function. Please check my below code:-</p>

<pre><code>&lt;?php
$file = new CreateFile();
$file-&gt;file = new CURLFile("File.txt", "text/plain", "file");
$file-&gt;folder = new stdClass();
$file-&gt;folder-&gt;id = 5565;
$file-&gt;folder-&gt;type = "Folder";
$file-&gt;name = "Test File.txt";
print_r($file-&gt;postData());

class CreateFile{
    private $host = "CHANGE ME";
    private $clientId = "CHANGE ME";
    private $clientSecret = "CHANGE ME";
    public $name;//name of file to create, required
    public $file;//CURLFile of file to input
    public $folder;//json object with two members, id and type(Folder or Program)
    public $description;//option description of file
    public $insertOnly;//boolean option to only perform an Insert

    public function postData(){
        $url = $this-&gt;host . "/rest/asset/v1/files.json?access_token=" . $this-&gt;getToken();
        $ch = curl_init($url);
        $requestBody = $this-&gt;bodyBuilder();
        curl_setopt($ch,  CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('accept: application/json','Content-Type: multipart/form-data'));
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody);
        curl_getinfo($ch);
        $response = curl_exec($ch);
        return $response;
    }

    private function getToken(){
        $ch = curl_init($this-&gt;host . "/identity/oauth/token?grant_type=client_credentials&amp;client_id=" . $this-&gt;clientId . "&amp;client_secret=" . $this-&gt;clientSecret);
        curl_setopt($ch,  CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('accept: application/json',));
        $response = json_decode(curl_exec($ch));
        curl_close($ch);
        $token = $response-&gt;access_token;
        return $token;
    }
    private function bodyBuilder(){
        $requestBody = array("file" =&gt; $this-&gt;file, "name" =&gt; $this-&gt;name, "folder" =&gt; json_encode($this-&gt;folder));
        if (isset($this-&gt;description)){
            $requestBody["description"] = $this-&gt;description;
        }
        if(isset($this-&gt;insertOnly)){
            $requestBody["insertOnly"] = $this-&gt;insertOnly;
        }
        return $requestBody;
    }   
}
</code></pre>