Advertisement
Guest User

function _fileinput

a guest
Nov 13th, 2015
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.47 KB | None | 0 0
  1.  
  2.     //return > 0 is ok!
  3.     function _fileinput($name) {
  4.         var_dump($name);
  5.         $input['arquivo']        = $_FILES["$name"]["name"];
  6.         $input['arquivo']        = strtolower(str_replace("h","",$input['arquivo']));
  7.         $input['mimetype']       = $_FILES["$name"]["type"];
  8.         $input['temp']           = $_FILES["$name"]["tmp_name"];
  9.         $input['mimetypes']      = array("image/jpeg", "image/png");
  10.         $input['extencoes']      = array(".jpg", ".jpeg", ".png");
  11.         $input['extencao']       = strtolower(end(explode(".",$input['arquivo'])));
  12.         $input['mimetype']        = strtolower($input['mimetype']);
  13.         $input['novo']           = "[fi]"."[".date('Y-m')."]"."[".strtolower($name)."]"."[".rand(1000,9999)."]".".".$input['extencao'];
  14.        
  15.         var_dump($input);
  16.        
  17.         $x              = 0;
  18.         if ((array_search($input['extencao'], $input['extencoes']) !== FALSE) AND (array_search(mimetype, $input['mimetypes']) !== FALSE)) {
  19.             $x++;
  20.         }
  21.         else {
  22.             $x = 0;
  23.         }
  24.         var_dump($x);
  25.        
  26.         list($largura, $altura) = getimagesize($input['temp']);
  27.         if ($largura == "" || $altura == "") {
  28.             $x = 0;
  29.         }
  30.         else {
  31.             $x++;
  32.         }
  33.         var_dump($x);
  34.        
  35.         if ($x == 2) {
  36.             return $input['novo'];
  37.         }
  38.         else {
  39.             return 0;
  40.         }
  41.         var_dump($x);
  42.        
  43.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement