Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <br><br><br><br><br><br><br><br><br><br><br><br><center><div style="width:950px;height:auto;-webkit-border-radius: 20px;-moz-border-radius: 20px;border-radius: 20px;border:1px solid #FF0000;background:rgba(0,0,0,0.6);">
- <?php
- /////////////////////////////////// OPTIONS ///////////////////////////////////////////
- $siteurl = "domain.com/folder"; // Your Domain or subdomain (example domain.com or domain.com/folder)
- $sitename = "Image Upload"; // Site name
- $siteslogan = "Slogan"; // Your slogan
- $folder = "images"; // Folder for uploaded images (folder chmod 777)
- $maxsizekb = 4096; // Maximum allowed size of image
- $filetype = array("jpeg", "jpg", "gif", "bmp", "png"); // Allowed types of images
- ///////////////////////////////////////////////////////////////////////////////////////
- print("<title>" . $sitename . " - " . $siteslogan . "</title>\n");
- print("<body background=\"pg.jpg\" vlink=\"white\" alink=\"white\" link=\"white\" text=\"white\">\n");
- print("<center>\n");
- print("<h1>" . $sitename . "</h1>\n");
- print("Upload image (max " . $maxsizekb . " KB)<br>\n");
- print("<p>\n");
- print("<form enctype=\"multipart/form-data\" action=\"\" method=\"post\">\n");
- print("<input name=\"file\" type=\"file\" size=\"60\">\n");
- print("<br><br>\n");
- print("<input type=\"submit\" name=\"upload\" value=\" Upload \">\n");
- print("</form>");
- $maxbyte = $maxsizekb * 4096;
- if(isset($_POST["upload"])) {
- $temp = explode(".", $_FILES['file']['name']);
- $tip = array_pop($temp);
- if($_FILES['file']['size'] > $maxbyte) {
- print("<hr>The file has reached the maximum allowable size!<br>Maximum size: <b>" . $maxsizekb . "KB</b>\n");
- }
- else if(!in_array($tip, $filetype)) {
- print("<hr>That type of image is not allowed!<br>Allowed types: <b>" . implode(", ", $filetype) . "</b>\n");
- }
- else {
- $newplace = $folder . "/" . time() . ".jpg";
- $n = 2;
- if(move_uploaded_file($_FILES['file']['tmp_name'], $newplace)) {
- print("<hr><h2>Successful upload!</h2><br><br>");
- print("Image name: " . time() . ".jpg<br>\n");
- print("Image size: " . $_FILES['file']['size'] . "<br><br>\n");
- print("Direct link: <input type=text name=1 class=code onClick='this.select()' size=50 value='http://" . $siteurl . "/" . $newplace . "'><br><br>\n");
- print("HTML code: <input type=text name=2 class=code onClick='this.select()' size=50 value='<a href=http://" . $siteurl . "/" . $newplace . "><img src=http://" . $siteurl . "/" . $newplace . "></a>'><br><br>\n");
- print("Forum code: <input type=text name=2 class=code onClick='this.select()' size=50 value='[url=http://" . $siteurl . "/" . $newplace . "][img]http://" . $siteurl . "/" . $newplace . "][/img][/url]'><br><br>\n");
- print("<br><img src=" . $newplace . " width=50% height=50%><br><br><br>\n");
- }
- else
- print("<hr><h2>Error!</h2><br><br>\n");
- }
- }
- ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement