sEnte Posted February 19, 2017 at 08:48 PM Report Share #602623 Posted February 19, 2017 at 08:48 PM 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 "If It Ain't Broke, Break it and build something Cooler!" Unknown Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now