I need to count the number of input file elements because they are created dynamically at the click of a button
<input class="tf" type="file" name="pic[]" accept="image/*">
This is the line that is created dynamically, but I need to count the number of elements that were created, it does not work with count, how can I do it?
This is my php code, with the paragraph variable already right.
<?php
$paragrafo = isset($_POST['paragrafo']) ? $_POST['paragrafo'] : '';
$foto = isset($_FILES['pic']) ? $_FILES['pic'] : '' ;
echo count($_POST['pic']);
if(count($paragrafo) > 0 && $paragrafo != ''){
foreach($paragrafo as $item){
echo $item .'<br>';
}
} else {
echo "Nenhum paragrafo foi adicionado!";
}
? >