Guest User

Untitled

a guest
Jun 21st, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. <h1>My account</h1>
  2. <form action="my-account.php" method="post" enctype="multipart/form-data">
  3. Upload an image...
  4. <input type="file" name="profileimg">
  5. <input type="submit" name="uploadprofileimg" value="Upload Image">
  6.  
  7.  
  8. </form>
  9. <?php
  10. if(isset($_POST['uploadprofileimg']))
  11. {
  12. $image = base64_encode(file_get_contents($_FILES["profileimg"]["tmp_name"]));
  13.  
  14. $options = array('http'=>array(
  15. 'method'=>"POST",
  16. 'header'=>
  17. "Content-Type: application/x-www-form-urlencodedrn".
  18. "Authorization: Bearer 82afc16954948508dfcf37e0a899759f34ab26c2n",
  19. 'content' =>$image
  20. ));
  21. $context = stream_context_create($options);
  22. print_r($_FILES);
  23.  
  24.  
  25. $imgurURL = "https://api.imgur.com/3/image";
  26. $response = file_get_contents($imgurURL, false, $context);
  27.  
  28.  
  29.  
  30. }
  31.  
  32. ?>
  33.  
  34. Array ( [profileimg] => Array ( [name] => pexels-photo-374710.jpeg [type] =>
  35. [tmp_name] => [error] => 1 [size] => 0 ))
Add Comment
Please, Sign In to add comment