我有一个包含多个文件上传字段的表单,我已经成功在/ upload文件夹中上传了多个文件。 但是现在当我编辑表单时,我想将以前上传的文件显示为选定的文件,在这里我可以更改文件,添加新文件或删除文件。
echo form_open_multipart(site_url()."lead/update/$lead->id");
?>
<div class="box-body">
<div class="form-group">
<label for="InputFirstName">First name</label>
<input type="text" class="form-control" id="InputFirstName" name="InputFirstName" placeholder="Enter first name" value="<?php echo $lead->fname; ?>">
</div>
<div class="form-group">
<label for="InputLastName">Last name</label>
<input type="text" class="form-control" id="InputLastName" name="InputLastName" placeholder="Enter last name" value="<?php echo $lead->lname; ?>">
</div>
<div class="form-group">
<label for="InputEmail1">Email address</label>
<input type="email" class="form-control" id="InputEmail1" name="InputEmail1" placeholder="Enter email" value="<?php echo $lead->email; ?>">
<?php echo form_error('InputEmail1', '<span class="help-block">', '</span>'); ?>
</div>
<div class="form-group">
<label for="InputContact">Contact number</label>
<input type="text" class="form-control" id="InputContact" name="InputContact" placeholder="Enter contact number" value="<?php echo $lead->phone; ?>">
</div>
<div class="form-group">
<label for="InputSource">Source</lable>
<select name="source" id="InputSource" class="form-control">
<option value="Email"<?php if($lead->source=='Email') echo 'selected="selected"';?>>Email</option>
<option value="Phone"<?php if($lead->source=='Phone') echo 'selected="selected"';?>>Phone</option>
<option value="Website"<?php if($lead->source=='Website') echo 'selected="selected"';?>>Website</option>
</select>
</div>
<div class="form-group">
<label for="InputStatus">Status</label>
<select name="status" id="InputStatus" class="form-control">
<option value="Draft"<?php if($lead->status=='Draft') echo 'selected="selected"';?>>Draft</option>
<option value="In Progress" <?php if($lead->status=='In Progress') echo 'selected="selected"';?>>In Progress</option>
<option value="Responsible Assigned" <?php if($lead->status=='Responsible Assigned') echo 'selected="selected"';?>>Responsible Assigned</option>
</select>
</div>
<div class="form-group">
<label for="exampleInputFile">Add Attachments</label>
<input type="file" id="files" name="files[]">
<div class="contents"></div>
<div>
<a href="javascript:void(0);" class="add">Add more</a>
</div>
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
<?php echo form_submit(array('value'=>'Submit', 'class'=>'btn btn-primary btn_add', 'name'=>'SAVE')); ?>
</div>
<?php echo form_close(); ?>
这是我的代码