微擎附件媒体上传之单图、多图片、视频、音频

微擎上传视频,音频,图片前,要先设置一下支持的格式:【站点】->【附件设置】->【支持文件后缀】输入你想上传的文件的格式,不同的文件格式中以换行区分。

文本框 html 代码

<div class="fui-uploader fui-uploader-sm" data-max="5" data-count="0">
	<input type="file" name='imgFile0[]' id='imgFile0' multiple="" accept="image/*" >
</div>

人人商城中示例代码

<div class='fui-cell'>
	<div class='fui-cell-label'>上传身份证</div>
	<div class='fui-cell-info'>
		<ul class="fui-images fui-images-sm"></ul>
		<div class="fui-uploader fui-uploader-sm" data-max="5" data-count="0">
			<input type="file" name='cid' id='cid' multiple="" accept="image/*" >
		</div>
	</div>
</div>

上传图片后示例代码

<div class="fui-cell post-image" id="cell-images" style="display:block;">
	<div class="fui-cell-info">
		<ul class="fui-images fui-images-md">
			<li style="background-image:url('https://abc.com/attachment/images/2/2018/07/gFPfvQtmQQfdiqW66DIffis4v3SDs3.png')" class="image image-md " data-filename="images/2/2018/07/gFPfvQtmQQfdiqW66DIffis4v3SDs3.png">
				<span class="image-remove"><i class="icon icon-close"></i></span>
				<input type="hidden" name="" value="images/2/2018/07/gFPfvQtmQQfdiqW66DIffis4v3SDs3.png">
				<img src="https://abc.com/attachment/images/2/2018/07/gFPfvQtmQQfdiqW66DIffis4v3SDs3.png" style="opacity: 0;width:100%;height:100%;">
			</li>
		</ul>
		<div class="fui-uploader fui-uploader-md" data-max="5" data-count="0">
			<input type="file" multiple="multiple" aria-multiselectable="true" name="imgFile[]" id="imgFile" accept="image/*">
		</div>
	</div>
</div>

php代码

$comments = $_GPC['comments'];

foreach ($comments as $c ) {
	var_dump($c);
	$old_c = pdo_fetchcolumn('select count(*) from ' . tablename('ewei_shop_creditshop_comment') . ' where uniacid=:uniacid and logid=:logid and goodsid=:goodsid limit 1', array(':uniacid' => $_W['uniacid'], ':goodsid' => $c['goodsid'], ':logid' => $logid));
	
	if( empty($old_c) ){
		$comment = array('uniacid' => $uniacid, 'logid' => $logid, 'logno' => $log['logno'], 'goodsid' => $c['goodsid'], 'level' => $c['level'], 'content' => trim($c['content']), 'images' => (is_array($c['images']) ? iserializer($c['images']) : iserializer(array())), 'openid' => $openid, 'nickname' => $member['nickname'], 'headimg' => $member['avatar'], 'time' => time(), 'checked' => $checked);
		pdo_insert('ewei_shop_creditshop_comment', $comment);
	}
	else{
		$comment = array('append_content' => trim($c['content']), 'append_images' => (is_array($c['images']) ? iserializer($c['images']) : iserializer(array())), 'append_checked' => $checked, 'append_time' => time());
		pdo_update('ewei_shop_creditshop_comment', $comment, array('uniacid' => $_W['uniacid'], 'goodsid' => $c['goodsid'], 'logid' => $logid));
	}
}