Estou aqui a tentar criar uma maneira de se fazer o upload de uma imagem para o imgur.
<?php
if (isset($_POST['uploadprofileimg'])) {
$image = base64_encode(file_get_contents($_FILES['profileimg']['tmp_name']));
$options = array('http' => array(
'method' => "POST",
'header' => "Authorization: Bearer sdf1gs8fd1g8s3d8f3sgdf8s8fsdf1g3s8dfs8df\n",
"Content-Type: application/x-www-form-urlencoded",
'content' => $image
));
$context = stream_context_create($options);
$imgurURL = "https://api.imgur.com/3/image";
$response = file_get_contents($imgurURL, FALSE, $context);
}
?>
<h1>My account</h1>
<form action="" method="post" enctype="multipart/form-data">
Upload a profile image:
<input type="file" name="profileimg">
<input type="submit" name="uploadprofileimg" value="Upload Image">
</form>
O código faz o upload, no entanto, dá-me esta mensagem
Notice: file_get_contents(): Content-type not specified assuming application/x-www-form-urlencoded in C:\WebServer\Apache24\Apache24\htdocs\html\www\SocialNetwork\my-account.php on line 17
Não estou a perceber o porquê de estar a aparecer este erro
↧