Advertisement
blondeweb

Untitled

Jan 26th, 2015
459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. <?php
  2. #vars
  3.  
  4. $arq = $_FILES['file'];
  5. $g = $_POST['g'];
  6.  
  7. $ext = strtolower(substr($_FILES['file']['name'],-4)); //Pegando extensão do arquivo
  8.  
  9. if($g){
  10. if($ext !== ".mp3"){
  11. echo "Apenas .mp3";
  12. }elseif($arq['size'] >= 7340032){
  13. echo "Arquivo grande";
  14. }else{
  15. $new_name = date("Y.m.d-H.i.s").$ext; //Definindo um novo nome para o arquivo
  16. $dir = 'bg/'; //Diretório para uploads
  17. $con = new Config;
  18. $sessao = $_SESSION['username'];
  19. $up = $con->Con()->query("UPDATE user SET bg = '$new_name' WHERE username = '$sessao'");
  20. move_uploaded_file($_FILES['file']['tmp_name'], $dir.$new_name); //Fazer upload do arquivo
  21. $del = "bg/".$dadosF->bg;
  22. unlink($del);
  23. echo "".'<div class="capEffLoa"><div class="load">...</div></div>'."<meta http-equiv='Refresh' content='0; url='".ROOT."account/'>";
  24. }
  25. }
  26.  
  27. ?>
  28. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement