shopNC商城框架下修改的iframe上传图片功能,原来是Ajax上传,按要求需改成iframe上传。
按要求修改商品主属性图 和原来功能模块一模一样,(有些代码涉及保密 只能用temp代替)屏蔽原来templates/temp.php内相关的模块代码改成iframe,
<iframe src="<?php echo APP_SITE_URL; ?>/index.php?act=tempact&op=tempop" name="imgage_frame" id="imgage_frame" frameborder="0" width="814" height="290"scrolling="no"></iframe>
在tempact类的tempop方法加入相关的代码,<form>标签囊括的整个上传样式,action=$appSiteUrl.'/index.php?act=tempact&op=tempimageop',tempimageop方法内包含<form>标签囊括的整个上传样式和图片上传数据库等内容,其中有些数据是通过js传递的。例如:
<input type='file' class='input-file' name='goods_image' id='goods_image1' οnchange='upperCase()'>
<script language='javascript' type='text/javascript'>
function upperCase(){
$('#imagefield').val($('#goods_image1').val());
picform.submit();
$('#image_submit').show();
}
点击input 选中图片以后onchange事件自动调用js,显示在页面所上传的图片