Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(isset($_FILES['ufile']['name'])){
- if ($_POST['teste'] == "S"){
- echo "<table><tr><td><strong>File: ".$_FILES['ufile']['name']."</strong></td></tr></table><br>";
- }
- $matriz = array();
- $tmpName = $_FILES['ufile']['tmp_name'];
- $newName = "" . $_FILES['ufile']['name'];
- if(!is_uploaded_file($tmpName) ||
- !move_uploaded_file($tmpName, $newName)){
- echo "<table><tr><td><strong>Failed to read file ".$_FILES['ufile']['name']."</strong></td></tr></table>";
- } else {
- echo "<br>";
- //coloca o conteudo do arquivo para a variavel $arquivo
- $ponteiro = fopen ($_FILES['ufile']['name'],"r");
- $arquivo = '';
- while (!feof ($ponteiro)) {
- $arquivo = $arquivo.fgets($ponteiro,4096);
- }
- fclose ($ponteiro);
- if (unlink($_FILES['ufile']['name']) != 1) echo "Erro ao deletar arquivo!";
- $padrao = fnc_resgata_padrao($arquivo);
- if ($padrao == "COARRI"){
- $a = fnc_processa_coarri(trim($arquivo));
- prc_mostra_coarri($a);
- }
- elseif ($padrao == "CODECO") {
- $a = fnc_processa_codeco(trim($arquivo));
- prc_mostra_codeco($a);
- }
- elseif ($padrao == "BAPLIE") {
- $a = fnc_processa_baplie(trim($arquivo));
- prc_mostra_baplie($a);
- }
- else {
- echo "<table><tr><td><strong>Invalid file</strong></td></tr></table>";
- }
- }
- } else {
- echo "You need to select a file. Please try again.";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement