Ejemplo n.º 1
0
function saveData()
{
    include "../functions/db-connection.php";
    include "../functions/cla-connection.php";
    $conn = new cla_connection($hostname, $username, $password, $database);
    $fileName = basename($_REQUEST['fileToUpload']);
    $area = $_REQUEST['area'];
    $descri = $_REQUEST['txDescri'];
    $data = date("Y-m-d H:i:s");
    // INSERT
    $result = $conn->insert("podcast", array("descricao,arquivo,area,data"), array("'{$descri}','{$fileName}',{$area},'{$data}'"));
    //echo $result;
    //exit;
    $arrayRet['msg'] = $result;
    print json_encode($arrayRet);
}
Ejemplo n.º 2
0
        // Caminho de onde a imagem ficará
        $file_dir = $config["diretorio"] . $file_name;
        // Faz o upload da imagem
        move_uploaded_file($arquivo["tmp_name"], $file_dir);
        $file_path = $file_name;
    } else {
        echo "<h1>" . $erro[0] . "</h1>";
        exit;
    }
    /*
    	echo "<br>";
    	echo "Original : " . $arquivo['name'] . "<br>";
    	echo "Servidor : " . $file_path  . "<br>";
    	echo "Path ....: " . $file_dir . "<br>";
    	echo "EXT .....: " . $ext[1];
    */
    include "../functions/db-connection.php";
    include "../functions/cla-connection.php";
    $conn = new cla_connection($hostname, $username, $password, $database);
    $nome_original = $arquivo['name'];
    $nome_servidor = $file_path;
    $ext = $ext[1];
    $area = $_REQUEST['area'];
    $descri = $_REQUEST['txDescri'];
    $data = date("Y-m-d H:i:s");
    // INSERT
    $result = $conn->insert("podcast", array("descricao,nome_servidor,nome_original,ext,area,data"), array("'{$descri}','{$nome_servidor}','{$nome_original}','{$ext}',{$area},'{$data}'"));
    $ret = array();
    $ret['RETORNO'] = $result;
    print json_encode($ret);
}