thinkphp上传多个图片,只能上传一个图片和保存一个数据,什么原因?

需求:将同时上传的不同图片存到同一个表中的各自对应的字段,怎么实现??

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 自带函数 会遍历所有上传
你每次调用 他都遍历以便 所以你得到的永远是上传最后的一个
随便不明白你的第一句话的意思 但是建议你这样做
先上传所有到一个缓存文件夹里
然后移动文件 再存储最后的地址
温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-05-23
等我学完TP在来告诉你 等我

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网