CI Bonfire上传模块

时间:2013-08-07 13:08:01

标签: file-upload codeigniter-2 bonfire

尝试在我的某个模块中设置一个上传按钮...首先,浏览器中的视图是乱的,因为无法看到物理按钮......

有人这样做是为了帮忙吗? 以下是我的观看代码......

<?php echo form_open_multipart($this->uri->uri_string(), 'class="form-horizontal"'); ?>
    <fieldset>
        <div class="control-group <?php echo form_error('products_product_title') ? `enter code here`'error' : ''; ?>">
            <?php echo form_label('Product Title'. lang('bf_form_label_required'), 'products_product_title', array('class' => "control-label") ); ?>
            <div class='controls'>
        <input id="products_product_title" type="text" name="products_product_title" maxlength="50" value="<?php echo set_value('products_product_title', isset($products['products_product_title']) ? $products['products_product_title'] : ''); ?>"  />
        <span class="help-inline"><?php echo form_error('products_product_title'); ?></span>
        </div>

        <div class="control-group <?php echo form_error('products_product_path') ? 'error' : ''; ?>">
            <?php echo form_label('Upload Card'. lang('bf_form_label_required'), 'products_product_path', array('class' => "control-label") ); ?>
            <div class='controls'>
        <input id="products_product_path" type="submit" name="submit_form" value="<?php echo set_value('products_product_path', isset($products['products_product_path']) ? $products['products_product_path'] : ''); ?>"  />
        <span class="help-inline"><?php echo form_error('products_product_path'); ?></span>
        </div>


        </div>



        <div class="form-actions">
            <br/>
            <input type="submit" name="save" class="btn btn-primary" value="Create products" />
            or <?php echo anchor(SITE_AREA .'/developer/products', lang('products_cancel'), 'class="btn btn-warning"'); ?>

        </div>
    </fieldset>
    <?php echo form_close(); ?>

2 个答案:

答案 0 :(得分:0)

你错过了靠近顶部的一个收盘,这可能会影响它。

<fieldset>
    <div class="control-group <?php echo form_error('products_product_title') ? `enter code here`'error' : ''; ?>">
        <?php echo form_label('Product Title'. lang('bf_form_label_required'), 'products_product_title', array('class' => "control-label") ); ?>
        <div class='controls'>
            <input id="products_product_title" type="text" name="products_product_title" maxlength="50" value="<?php echo set_value('products_product_title', isset($products['products_product_title']) ? $products['products_product_title'] : ''); ?>"  />
            <span class="help-inline"><?php echo form_error('products_product_title'); ?></span>
        </div>
    </div>    <!-- this div needs to be added -->

在添加另一个控件之前关闭每个控件组。

答案 1 :(得分:0)

在Bonfire Ajax调用中,您只需在yout表单的open标记中使用class='ajax-form'即可。所以它应该是

<?php echo form_open_multipart($this->uri->uri_string(), 'class="ajax-form"'); ?>

参考: AJAX in Bonfire