Add More Button + File Upload

cesarvelame 11 Mar, 2014
Hi everyone!

I used this FAQ to do a form, but I don´t know how I can add upload files.

My code:


<?php
// set the total count
$count = 30;
for ( $i = 1; $i <= $count; $i++ ) {
  // add classes which will let us identify the inputs to hide
  if ( $i == 1 ) {
    $class = 'show_me';
  } else {
    $class = 'hide_me';
  }
  // add the 'Add one' buttons (but not to the last set)
  if ( $i < $count ) {
    $j = $i+1;
    $button = "<div><input type='button' name='addone_{$j}' id='addone_{$j}' value='+ Adicionar' class='add_one' /></div>";
  } else {
    $button = "";
  }
  // add the inputs with a little ChronoForms styling
  echo "<div id='recipient_{$i}' class='{$class}' >
  <div class='multiline_start'>
    <label>Item</label>
	<select size='1' name='recipient[{$i}][item]' id='recipient_{$i}_item'>
		<option value>Selecione...</option>
		<option value='item1'>Item 1</option>
<option value='item2'>Item 2</option>
<option value='item3'>Item 3</option>
	</select>
  </div>
  <div class='multiline_add'>
    <label>Quantity</label>
    <input type='text' size='6' name='recipient[{$i}][qtd]' id='recipient_{$i}_qtd' />
  </div>
    <div class='multiline_add'>
    <label>File</label>
	<input type='hidden' name='recipient[{$i}][file]' value='' alt='ghost'>
	<input type='file' name='recipient[{$i}][file]' id='recipient_{$i}_file'>
  </div>
  <div class='clear' ></div>
  {$button}
</div>";
}
?>


In File Uploads action I put:

recipient[1][file]:pdf-cdr-psd-ai-in,recipient[2][file]:pdf-cdr-psd-ai-in,recipient[3][file]:pdf-cdr-psd-ai-in

I tested too:

recipient_1_file:pdf-cdr-psd-ai-in,recipient_2_file:pdf-cdr-psd-ai-in,recipient_3_file:pdf-cdr-psd-ai-in

But the upload is not working.

What I´m doing wrong?
cesarvelame 11 Mar, 2014
I forgot to say that the add more button is working well. Just the file upload is not working.
Qbik 27 Mar, 2014
is it working on Chronoforms v5??
I cant manage it to work😟
GreyHead 27 Mar, 2014
Hi Qbik,

As far as I know it's available only on CFv4.

Bob
This topic is locked and no more replies can be posted.