Error with CURLFile

0

Hello everyone. I have the following code:

<form action="" method="POST" enctype="multipart/form-data">
<input type="file" name="image">
<input type="submit" value="POST">
</form>

<?php
if (isset($_FILES['image']['tmp_name'])){

	$ch = curl_init();
	$cfile = new CURLFile($_FILES['image']['tmp_name'], $_FILES['image']['type'], $_FILES['image']['name']);
	$data = array("myimage" => $cfile);

	curl_setopt($ch, CURLOPT_URL, "http://meuhost/upload.php");
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

	$response = curl_exec($ch);

	if($response == true) {echo "Arquivo enviado";}
	else {echo "Erro: " . curl_error($ch);}
	
}
?>

However, I'm getting the following error back.

Fatal error: Class 'CURLFile' not found in /var/www/protocolo/teste/cria.php on line 10

What can it be? My CURL is enabled on the server!

    
asked by anonymous 12.06.2017 / 20:38

0 answers