Data passed via function

0

I created a function to register images that until yesterday at 6:00 PM worked normally and this morning the form data is not being passed. incredible as it may seem, nobody tampered with the code.

<?php //Chama a função inserir caso tenha algum dado em POST (includes/conexao)
if (isset($_POST['salvar'])) {
    criar_album('albumImagens', 'capa', $_POST);
}  
?>

<form class="form-horizontal" method="POST" action="" enctype="multipart/form-data" />
  <fieldset>

    <legend>Nova imagem</legend>
    <div class="form-group">
      <label class="col-md-3 control-label" for="nome">Nome</label>  
      <div class="col-md-6">
        <input id="nome" name="nome" type="text" placeholder="" class="form-control input-md" required>
      </div>
    </div>

    <!-- Text input --> 
    <div class="form-group">   
      <div id="thumbnail">
      </div>
      <label class="col-md-3 control-label" for="capa">Capa:</label>  
      <div class="col-md-4">
        <input type="file" name="capa" class="form-control" required>
      </div>
    </div>

    <!-- Text input-->
    <div class="form-group">
      <label class="col-md-3 control-label" for="imagem">Album:</label>  
      <div class="col-md-4">
        <input type="file" name="imagem[]" class="form-control" required multiple>
      </div>
    </div>

    <!-- Button -->
    <div class="form-group">
      <label class="col-md-3 control-label" for="salvar"></label>
      <div class="col-md-5">
        <button name="salvar" class="btn btn-primary btn-lg">Salvar</button>
      </div>
    </div>

  </fieldset>
</form>

To check if the data was being passed I did;

function criar_album($album, $destaque, $dados){
    $con = conectar();
    var_dump($dados); 
    die();
}

And the only data passed is the first input nome .

Does anyone know what might be happening?

    
asked by anonymous 16.09.2015 / 14:28

1 answer

1

If the form method is POST, for input type file use $ _FILES instead of $ _POST

<?php 
//Chama a função inserir caso tenha algum dado em POST  (includes/conexao)
if (isset($_POST['salvar'])) {
    print_r($_FILES);
}  
?>

Test also modifying the form method for GET

<?php
  if (isset($_GET['salvar'])) {
        print_r($_GET);
 } 
?>
<form class="form-horizontal" method="POST" action="" enctype="multipart/form-data" />
  <fieldset> ....
....
    
17.09.2015 / 14:57