Guest User

Untitled

a guest
Feb 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.44 KB | None | 0 0
  1. <?php
  2.    
  3.    
  4.     if (isset($_FILES['foto']) and $_FILES['foto']['size'] > 0) {
  5.         $ruta       = $_FILES['foto']['tmp_name'];
  6.         $tipo       = explode('/', $_FILES['foto']['type']);
  7.         $tipoArchivo    = $tipo[0];
  8.         $ext        = $tipo[1];
  9.        
  10.         if ($tipoArchivo == 'image') {
  11.             $nombre = md5(time().rand()).'.'.$ext;
  12.             $destino = '../data/'.$nombre;
  13.            
  14.             move_uploaded_file($ruta, $destino);
  15.            
  16.             echo '<img src="'.$destino.'" alt="" />';
  17.         }
  18.     }
  19. ?>
Add Comment
Please, Sign In to add comment