deez

Système d'upload [2]

May 19th, 2012
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.95 KB | None | 0 0
  1. <?php
  2.  
  3. class upload
  4. {
  5.    
  6.     function create_form($action,$submit){
  7.         $form = '<center><p><form method="post" action="'.$action.'" enctype="multipart/form-data">
  8.                   </p><input type="file" size="40px" name="img"/>
  9.                    <input type="submit" value="'.$submit.'" />
  10.              
  11.                </form></center>';
  12.         return $form;
  13.     }
  14.    
  15.     function check ($tmp,$nom,$dos,$autoris)
  16.     {
  17.         $ext = strtolower(substr($nom,-3));
  18.         if(in_array($ext,$autoris)){
  19.             $randid = rand(1,1000000);
  20.             $dosnom = $dos.$randid.".(MegaUpload)".$nom;
  21.             move_uploaded_file($tmp,$dosnom);
  22.             $valid = "Votre fichier a bien été uploadé.<br/>Vous pouvez visiter en <a href=\"".$dosnom."\">cliquant ici</a>. ";
  23.         }
  24.         else{
  25.             $valid = "Votre fichier n'est pas supporté par notre serveur.";
  26.         }
  27.         return $valid;
  28.    
  29.     }
  30. }
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment