<?php


$_UP['extensoes'] = array('pdf', 'PDF', 'doc', 'DOC', 'jpg', 'JPG', 'png', 'PNG', 'bmp', 'BMP', 'gif', 'GIF', 'JPEG', 'jpeg');
$pasta = 'fotos/';

$tmp_name = $_FILES["arquivo"]["tmp_name"];
$temp = substr(md5(uniqid(time())), 0, 10);
$titulo = $_FILES["arquivo"]["name"];
$extensao = strtolower(end(explode('.',$_FILES["arquivo"]["name"])));
$cod = $pasta . date('dmy') . '-' . $temp . '.' . $extensao;
$nome = $_FILES["arquivo"]["name"];
$uploadfile = $pasta . basename($cod);
if ($tmp_name != '') {
    if (array_search($extensao, $_UP['extensoes']) === false) {
        $foto = "";
    }
    else {
        move_uploaded_file($tmp_name, $uploadfile);

        $foto = $uploadfile;
    }
}


    $dados['default'] = $fotos;

    echo json_encode($dados);

?>