Last active
December 20, 2015 08:18
-
-
Save bytefade/6099029 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try { | |
$arquivos = parsePostSegundaEtapa(); | |
// echo $_SESSION['imagen']; | |
$path = realpath(dirname(__FILE__)) . "/../../images/upload/"; | |
die($path); | |
// -- Criando o diretório de armazenamento dos anexos da proposta | |
if (!is_dir($path)) { | |
mkdir($path, 0777, true); | |
} | |
// -- Armazenando os arquivos para posterior validação | |
foreach ($arquivos as $arquivo => $infoArquivo) { | |
$ext = strtolower($infoArquivo['ext']); | |
if (!move_uploaded_file($infoArquivo['tmp_name'], "{$path}{$arquivo}.{$ext}")) { | |
$e = new Exception('Não foi possível realizar o armazenamento do arquivo.'); | |
throw $e; | |
} | |
} | |
} catch (Exception $e) { | |
echo "Erro: ".$e->getMessage(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment