Public paste
file
By: Xmoo | Date: May 13 2009 14:43 | Format: PHP | Expires: never | Size: 3.31 KB | Hits: 650

  1. <?php
  2. $user = $_SESSION['username'];
  3. $location = "files/";
  4. $check = $_SESSION['username']; + "-" + $_FILES['upload']['name'];
  5. $check2 = $_SESSION['username']; + "-2" + $_FILES['upload']['name'];
  6.  
  7. echo "<font class='kop'>File Upload</font><br><br>";
  8. if(!empty($_POST)){
  9.    if(is_uploaded_file($_FILES['upload']['tmp_name']))
  10.    {  
  11.         if($_FILES['upload']['size']>640000)
  12.                    {
  13.         echo "<img src='images/pointers/delete.png' alt='ERROR' border='0'> <b>File to BIG! (Max 500kb allowed)</b>";
  14.                    exit;
  15.                    }
  16.         if(!eregi("((.jpg|.JPG|.gif|.GIF|.jpeg|.JEPG|.png|.PNG)$)", $_FILES['upload']['name']))
  17.                    {
  18.         echo "<img src='images/pointers/delete.png' alt='ERROR' border='0'> <b>Wrong extension! (JPG, GIF & PNG allowed!)</b>";
  19.                    exit;
  20.                    }
  21.         if(!move_uploaded_file($_FILES['upload']['tmp_name'],$location.$user."-".$_FILES['upload']['name']))
  22.         if (file_exists($check)) {
  23.                 rename("".$check."","".$check2."");
  24.     echo"<img src='images/pointers/delete.png' alt='ERROR' border='0'> <b>File could not move!</b>";
  25.                   exit;
  26.                         }
  27.                         else {  
  28. echo "<br><img src='images/pointers/view.png' alt='SUCCES' border='0'> <b>The File: <a href='http://www.xmoo.org/mytrainer/".$location."".$user."-".$_FILES['upload']['name']."' target='_blank'>".$user."-".$_FILES['upload']['name']."</a> Has Been Uploaded!</b>
  29. <br><br><br>
  30. <b>URL:</b><br>
  31. <input type='text' name='url' size='59' onclick='javascript:url.focus();url.select();' value='http://www.xmoo.org/mytrainer/".$location."".$user."-".$_FILES['upload']['name']."' READONLY/>
  32. <br><br>
  33. <b>Link:</b><br>
  34. <textarea name='textarea' onclick='javascript:textarea.focus();textarea.select();' cols='45' rows='4' READONLY>
  35. [url]http://www.xmoo.org/mytrainer/".$location."".$user."-".$_FILES['upload']['name']."[/url]</textarea>
  36. <br><br>
  37. <b>Link with title:</b><br>
  38. <textarea name='textarea' onclick='javascript:textarea.focus();textarea.select();' cols='45' rows='4' READONLY>
  39. [url=http://www.xmoo.org/mytrainer/".$location."".$user."-".$_FILES['upload']['name']."]".$user."".$_FILES['upload']['name']."[/url]</textarea>
  40. <br><br>      
  41. <b>Image:</b><br>
  42. <textarea name='textarea' onclick='javascript:textarea.focus();textarea.select();' cols='45' rows='4' READONLY>
  43. [img]http://www.xmoo.org/mytrainer/".$location."".$user."-".$_FILES['upload']['name']."[/img]</textarea>
  44. <br><br>    
  45. <b>Thumbnail:</b><br>
  46. <textarea name='textarea' onclick='javascript:textarea.focus();textarea.select();' cols='45' rows='4' READONLY>
  47. [thumb]http://www.xmoo.org/mytrainer/".$location."".$user."-".$_FILES['upload']['name']."[/thumb]</textarea>
  48. <br><br>    
  49. <b>Image link:</b><br>
  50. <textarea name='textarea' onclick='javascript:textarea.focus();textarea.select();' cols='45' rows='4' READONLY>
  51. [link]http://www.xmoo.org/mytrainer/".$location."".$user."-".$_FILES['upload']['name']."[/link]</textarea>";
  52.    } else { echo "<img src='images/pointers/delete.png' alt='ERROR' border='0'> <b>The Upload has failed!</b>"; }
  53. } } else {
  54. echo '<center><form method="post" action="" enctype="multipart/form-data">
  55.     <b>File:</b> <input type="file" name="upload" size="50" /><br/> <br/>
  56.     <input type="submit" name="submit" value="Upload!" /></form></center>';
  57. }
  58. ?>