Public paste
File2
By: Xmoo | Date: May 13 2009 13:09 | Format: PHP | Expires: never | Size: 3.13 KB | Hits: 635

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