level 1
wide288
楼主
模板:
addProduct.html
------------------------------
<script language="JavaScript">
<!--
function add(){
ThinkAjax.sendForm('form1','__URL__/insertProduct',complete,'result');
}
function complete(data,status){
if (status==1)
{
window.setTimeout(function (){window.location.href='__URL__/listProduct',20000});
}
}
//-->
</script>
<div class="main">
<h2>产品添加</h2>
<form id="form1" method='post' action="__URL__/insertProduct" enctype="multipart/form-data">
<table cellpadding=2 cel
lsp
acing=2>
<tr>
<td colspan="2"><div id="result" class="none result" style="font-family:微软雅黑,Tahoma;letter-spacing:2px"></div></td>
</tr>
<tr>
......
...
...
<tr>
<td class="tRight" width="12%">图片:</td>
<td class="tLeft" ><input type="file" name="photo" style="height:23px" class="huge bLeft"> </td>
</tr>
<tr>
<td><input type="hidden" name="ajax" value="1"></td>
<td><input type="button" onClick="add()" class="button" value="保 存"> <input type="reset" class="button" value="清 空"></td>
</tr>
</table>
</form>
------------------------------------------------------------------
控制器
---------------------------
public function insertProduct() {
if (!empty($_FILES)) {
//如果有文件上传 上传附件
$this->_upload();
//$this->forward();
}
}
// 文件上传
protected function _upload() {
import("@.ORG.UploadFile");
$upload = new UploadFile();
//设置上传文件大小
$upload->maxSize = 3292200;
//设置上传文件类型
$upload->allowExts = explode(',', 'jpg,gif,png,jpeg');
//设置附件上传目录
$upload->savePath = '../Public/Uploads/';
//设置需要生成缩略图,仅对图像文件有效
2010年12月01日 07点12分
1
addProduct.html
------------------------------
<script language="JavaScript">
<!--
function add(){
ThinkAjax.sendForm('form1','__URL__/insertProduct',complete,'result');
}
function complete(data,status){
if (status==1)
{
window.setTimeout(function (){window.location.href='__URL__/listProduct',20000});
}
}
//-->
</script>
<div class="main">
<h2>产品添加</h2>
<form id="form1" method='post' action="__URL__/insertProduct" enctype="multipart/form-data">
<table cellpadding=2 cel
lsp
acing=2>
<tr>
<td colspan="2"><div id="result" class="none result" style="font-family:微软雅黑,Tahoma;letter-spacing:2px"></div></td>
</tr>
<tr>
......
...
...
<tr>
<td class="tRight" width="12%">图片:</td>
<td class="tLeft" ><input type="file" name="photo" style="height:23px" class="huge bLeft"> </td>
</tr>
<tr>
<td><input type="hidden" name="ajax" value="1"></td>
<td><input type="button" onClick="add()" class="button" value="保 存"> <input type="reset" class="button" value="清 空"></td>
</tr>
</table>
</form>
------------------------------------------------------------------
控制器
---------------------------
public function insertProduct() {
if (!empty($_FILES)) {
//如果有文件上传 上传附件
$this->_upload();
//$this->forward();
}
}
// 文件上传
protected function _upload() {
import("@.ORG.UploadFile");
$upload = new UploadFile();
//设置上传文件大小
$upload->maxSize = 3292200;
//设置上传文件类型
$upload->allowExts = explode(',', 'jpg,gif,png,jpeg');
//设置附件上传目录
$upload->savePath = '../Public/Uploads/';
//设置需要生成缩略图,仅对图像文件有效