Skip to content

Instantly share code, notes, and snippets.



Last active Oct 16, 2018
What would you like to do?
include 'upload.php';
<!DOCTYPE html>
<title>Imgur Image upload in php</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
<link rel="stylesheet" href="//">
<script src="//"></script>
<header class="w3-container w3-teal">
<h1 class='w3-center'>Imgur Image Upload</h1>
<div class='w3-content w3-center'>
<form class="w3-border w3-padding w3-round w3-margin" action="index.php" method="post" enctype="multipart/form-data">
<label><b>Select Image - </b></label>
<input type="file" name="image" id="image"></p>
<input type="submit" class='w3-blue w3-round w3-btn' name="submit" value="Submit"></p>
<div class='w3-content'>
$path = "images/";
$image = $_FILES['image']['tmp_name'];
$image = json_decode(upload_image($path,$image),true);
echo "<pre>";
echo "<b><h1>Image -</h1></b><img src=".$image['data']['link']." class='w3-image'>";
echo "<br>";
echo "<b><h1>Image Link -</h1></b> <a href=".$image['data']['link'].">".$image['data']['link']."</a>";
<pre><code class='json'><?php print_r($image); ?></code></pre>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment