Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- #vars
- $arq = $_FILES['file'];
- $g = $_POST['g'];
- $ext = strtolower(substr($_FILES['file']['name'],-4)); //Pegando extensão do arquivo
- if($g){
- if($ext !== ".mp3"){
- echo "Apenas .mp3";
- }elseif($arq['size'] >= 7340032){
- echo "Arquivo grande";
- }else{
- $new_name = date("Y.m.d-H.i.s").$ext; //Definindo um novo nome para o arquivo
- $dir = 'bg/'; //Diretório para uploads
- $con = new Config;
- $sessao = $_SESSION['username'];
- $up = $con->Con()->query("UPDATE user SET bg = '$new_name' WHERE username = '$sessao'");
- move_uploaded_file($_FILES['file']['tmp_name'], $dir.$new_name); //Fazer upload do arquivo
- $del = "bg/".$dadosF->bg;
- unlink($del);
- echo "".'<div class="capEffLoa"><div class="load">...</div></div>'."<meta http-equiv='Refresh' content='0; url='".ROOT."account/'>";
- }
- }
- ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement