Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2017
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. <?php
  2. include("conexao.php");
  3.  
  4. $msg = false;
  5.  
  6. if(isset($_FILES['arquivo'])){
  7.  
  8. $extensao = strtolower(substr($_FILES['arquivo']['name'], -4));
  9. $novo_nome = md5(time()) .$extensao;
  10. $diretorio = "animes/";
  11.  
  12.  
  13. move_uploaded_file($_FILES['arquivo']['tmp_name'], $diretorio.$novo_nome);
  14.  
  15. $sql_code = "INSERT INTO arquivo (codigo, arquivo, data) VALUES (null, '$novo_nome', NOW())";
  16. if ($mysqli->query($sql_code))
  17. $msg = "Arquivo enviado";
  18.  
  19. else
  20. $msg = "Falha ao enviar.";
  21.  
  22. }
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement