在我的表单中我有这个脚本,但是当我尝试发送文件(图像)时,我只有一个
var_dump($_POST['FILES'])`
我可能犯了错误?
$('select[name=\'type\']').on('change', function() {
if (this.value == 'select' || this.value == 'radio' || this.value == 'checkbox' || this.value == 'image') {
$('#option-value').parent().show();
} else {
$('#option-value').parent().hide();
}
});
$('select[name=\'type\']').trigger('change');
var option_value_row = <?php echo $i; ?>
function addOptionValue() {
html = '<tr id="option-value-row' + option_value_row + '">';
html += ' <td><input type="hidden" name="option_value[' + option_value_row + '][option_value_id]" value="" />';
<?php
for ($l=0, $n=count($languages); $l<$n; $l++) {
?>
html += '<?php echo $OSCOM_Language->getImage($languages[$l]['code']); ?><input type="text" name="option_value[' + option_value_row + '][option_value_description][name][<?php echo $l; ?>]" value="" class="form-control" required aria-required="true" />';
html += '<input type="hidden" name="option_value[' + option_value_row + '][option_value_description][language_id][<?php echo $l; ?>]" value="<?php echo $OSCOM_Language->getID($languages[$l]['code']); ?>" class="form-control" />';
<?php
}
?>
html += ' </td>';
html += ' <td>';
html += ' <input type="file" name="option_value[' + option_value_row + '][image]" value="" accept="image/*" class="form-control" />';
html += ' <input type="hidden" name="MAX_FILE_SIZE" value="1024">';
html += ' </td>';
html += ' <td class="text-md-right"><input type="text" name="option_value[' + option_value_row + '][sort_order]" value="" class="form-control" /></td>';
html += ' <td class="text-md-right"><button type="button" onclick="$(\'#option-value-row' + option_value_row + '\').remove();" data-toggle="tooltip" title="button_remove" class="btn btn-danger"><i class="fas fa-minus-circle"></i></button></td>';
html += '</tr>';
$('#option-value tbody').append(html);
option_value_row++;
}