Advertisement
Guest User

Untitled

a guest
Mar 1st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. if(isset($_FILES['ufile']['name'])){
  2. if ($_POST['teste'] == "S"){
  3. echo "<table><tr><td><strong>File: ".$_FILES['ufile']['name']."</strong></td></tr></table><br>";
  4. }
  5. $matriz = array();
  6. $tmpName = $_FILES['ufile']['tmp_name'];
  7. $newName = "" . $_FILES['ufile']['name'];
  8. if(!is_uploaded_file($tmpName) ||
  9. !move_uploaded_file($tmpName, $newName)){
  10. echo "<table><tr><td><strong>Failed to read file ".$_FILES['ufile']['name']."</strong></td></tr></table>";
  11. } else {
  12. echo "<br>";
  13.  
  14. //coloca o conteudo do arquivo para a variavel $arquivo
  15. $ponteiro = fopen ($_FILES['ufile']['name'],"r");
  16. $arquivo = '';
  17. while (!feof ($ponteiro)) {
  18. $arquivo = $arquivo.fgets($ponteiro,4096);
  19.  
  20. }
  21. fclose ($ponteiro);
  22. if (unlink($_FILES['ufile']['name']) != 1) echo "Erro ao deletar arquivo!";
  23.  
  24. $padrao = fnc_resgata_padrao($arquivo);
  25.  
  26. if ($padrao == "COARRI"){
  27. $a = fnc_processa_coarri(trim($arquivo));
  28.  
  29. prc_mostra_coarri($a);
  30. }
  31. elseif ($padrao == "CODECO") {
  32. $a = fnc_processa_codeco(trim($arquivo));
  33. prc_mostra_codeco($a);
  34. }
  35. elseif ($padrao == "BAPLIE") {
  36. $a = fnc_processa_baplie(trim($arquivo));
  37. prc_mostra_baplie($a);
  38. }
  39. else {
  40. echo "<table><tr><td><strong>Invalid file</strong></td></tr></table>";
  41. }
  42.  
  43. }
  44. } else {
  45. echo "You need to select a file. Please try again.";
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement