I'm using the following tutorial to upload an image to imgur. I want to know whether it's necessary to have base64_encode
when sending the data.
Here's a small code snippet:
$img=$_FILES['img'];
$filename = $img['tmp_name'];
$data = fread($handle, filesize($filename));
$pvars = array('image' => base64_encode($data)); // Here's the base64_encode
curl_setopt($curl, CURLOPT_POSTFIELDS, $pvars);
Is it necessary to have base64_encode
and why?
To see the full code, you can go here.
According to the Imgur documentation, there are alternative methods.
So, to answer your question, no it is not required as long as it is one of the other two supported options.