Use CURLFile class when available to replace the @filename API for file uploading