コード例 #1
0
<?php

require_once '../_loadPaths.inc.php';
$path = $_SESSION['PATH_SYS'];
include_once $path['controller'] . 'EscolaController.php';
include_once $path['controller'] . 'DocumentoController.php';
include_once $path['controller'] . 'DocumentoEnvioController.php';
include_once $path['controller'] . 'DocumentoRetornoController.php';
include_once $path['controller'] . 'DocumentoDestinatarioController.php';
include_once $path['funcao'] . 'DatasFuncao.php';
$escolaController = new EscolaController();
$documentosController = new DocumentoController();
$documentoEnvioController = new DocumentoEnvioController();
$documentoRetornoController = new DocumentoRetornoController();
$documentoDestinatarioController = new DocumentoDestinatarioController();
$maxSize = 30000000;
//Tamanho máximo de arquivo 30Mb
switch ($_REQUEST['acao']) {
    case 'postDocumento':
        $_SESSION["cadastro"] = "";
        $documento = new Documento();
        $documento->setDoc_assunto($_REQUEST['assunto']);
        $documento->setDoc_descricao($_REQUEST['descricao']);
        $nomeArquivo = "_" . md5(uniqid(rand(), true)) . '.' . pathinfo($_FILES['arquivo']['name'], PATHINFO_EXTENSION);
        $arquivo_temporario = $_FILES["arquivo"]["tmp_name"];
        $local = $path['documentos'];
        if (filesize($arquivo_temporario) > $maxSize) {
            $_SESSION['cadastro'] = "excedeu";
        } else {
            move_uploaded_file($arquivo_temporario, $local . $nomeArquivo);
            $arquivo = $local . $nomeArquivo;
コード例 #2
0
<?php

require_once '../_loadPaths.inc.php';
$path = $_SESSION['PATH_SYS'];
include_once $path['controller'] . 'DocumentoController.php';
include_once $path['controller'] . 'DocumentoEnvioController.php';
include_once $path['controller'] . 'DocumentoRetornoController.php';
include_once $path['beans'] . 'Documento.php';
include_once $path['beans'] . 'DocumentoEnvio.php';
include_once $path['beans'] . 'DocumentoRetorno.php';
include_once $path['funcao'] . 'DatasFuncao.php';
$documentosController = new DocumentoController();
$documentosEnvioController = new DocumentoEnvioController();
$maxSize = 30000000;
//Tamanho máximo de arquivo 30Mb
switch ($_REQUEST['acao']) {
    case 'postDocumento':
        $assunto = $_REQUEST['assunto'];
        $descricao = $_REQUEST['descricao'];
        $documento = new Documento();
        $documento->setDoc_assunto(utf8_decode($assunto));
        $documento->setDoc_descricao(utf8_decode($descricao));
        $nomeArquivo = "_" . md5(uniqid(rand(), true)) . '.' . pathinfo($_FILES['arquivo']['name'], PATHINFO_EXTENSION);
        $arquivo_temporario = $_FILES["arquivo"]["tmp_name"];
        $local = $path['documentos'];
        if (filesize($arquivo_temporario) > $maxSize) {
            $_SESSION['cadastro'] = "excedeu";
        } else {
            move_uploaded_file($arquivo_temporario, $local . $nomeImage);
            $arquivo = $local . $nomeImage;
        }