Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h1>My account</h1>
- <form action="my-account.php" method="post" enctype="multipart/form-data">
- Upload an image...
- <input type="file" name="profileimg">
- <input type="submit" name="uploadprofileimg" value="Upload Image">
- </form>
- <?php
- if(isset($_POST['uploadprofileimg']))
- {
- $image = base64_encode(file_get_contents($_FILES["profileimg"]["tmp_name"]));
- $options = array('http'=>array(
- 'method'=>"POST",
- 'header'=>
- "Content-Type: application/x-www-form-urlencodedrn".
- "Authorization: Bearer 82afc16954948508dfcf37e0a899759f34ab26c2n",
- 'content' =>$image
- ));
- $context = stream_context_create($options);
- print_r($_FILES);
- $imgurURL = "https://api.imgur.com/3/image";
- $response = file_get_contents($imgurURL, false, $context);
- }
- ?>
- Array ( [profileimg] => Array ( [name] => pexels-photo-374710.jpeg [type] =>
- [tmp_name] => [error] => 1 [size] => 0 ))
Add Comment
Please, Sign In to add comment