需求:将同时上传的不同图片存到同一个表中的各自对应的字段,怎么实现??
1、模板代码显示:
<tr>
<th>站点logo:</th>
<td>
<input type="file" name="img" id="img" class="input-text" size=21 />
<if condition="$set['site_logo'] neq ''">
<img src="{$set['site_logo']}" style="max-height:64px;" />
</if>
</td>
</tr>
<tr>
<th>硕士logo</th>
<td>
<input type="file" name="master_logo" id="master_logo" class="input-text" size=21 />
<if condition="$set['master_logo'] neq ''">
<img src="{$set['master_logo']}" style="max-height:64px;" />
</if>
</td>
</tr>
<tr>
<th>机构logo</th>
<td>
<input type="file" name="institute_logo" id="institute_logo" class="input-text" size=21 />
<if condition="$set['institute_logo'] neq ''">
<img src="{$set['institute_logo']}" style="max-height:64px;" />
</if>
</td>
</tr>
2、thinphp代码:
用thinkphp的一般上传文件的代码
然后调用。
你的那个upload函数不行
thinkphp 自带函数 会遍历所有上传
你每次调用 他都遍历以便 所以你得到的永远是上传最后的一个
随便不明白你的第一句话的意思 但是建议你这样做
先上传所有到一个缓存文件夹里
然后移动文件 再存储最后的地址