怎么才能将html代码里的{.filename}和{.savename} 这两个值赋值到 html里的hidden的 value里啊?
doc.php页面function download(){
$filename = (string) $this->input->post('filename');
$path = (string) $this->input->post('path');
$path = '/home/gw/uploads/documents/'.$path;
header('Pragma: public');
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, max-age=0, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: post-check=0, pre-check=0', false);
header('Cache-Control: private');
header('Content-Transfer-Encoding: UTF-8');
header('Content-Disposition: attachment; filename='.$filename.'');
header('Content-Type: application/octet-stream; name="'.$filename.'"');
echo file_get_contents($path);
exit;
}public function add($seq='')
{
$data = array('info' => array(),'doc' =>array());
if(strlen($seq) > 0)
{
$document = Cl::get('Document');
try
{
$document->load($seq);
$data['info'] = array(
'document_files' => strlen($document['document_files']) > 0 ? json_decode($document['document_files'],true):'',
);
}
catch(Exception $e){}
}
$data['doc'] = Cl::get('Document');
$this->_layout("popup");
$this->_view($data);
}html页面
<form name="frm_document" action="" target="ifm" method="post" enctype="multipart/form-data" onsubmit="return false;">
<input type="hidden" name="filename" value="希望这里赋值{.filename}这个,但这个是下面获得的" />
<input type="hidden" name="path" value="希望这里赋值{.savename}这个,但这个是下面获得的" />
<table class="formTable">
<tbody> <tr>
<th>上传文件</th>
<td>
<!--{? count(info.document_files) >0 }-->
<input type="file" class="file" name="document_file[]" value="" style="height:27px;"/><br>
<input type="file" class="file" name="document_file[]" value="" style="height:27px;"/><br>
<input type="file" class="file" name="document_file[]" value="" style="height:27px;"/>
<!--{@ info.document_files}-->
<br><a class="download">{.filename}{.savename}</a> // 这里是通过php页面中的document_files获取到的,使用的是templete_
<!--{/}-->
<!--{/}-->JS 代码 $('.download').click(function(){
$('form[name=frm_document]').attr('action','/hr/doc/download');
$('form[name=frm_document]').submit();
});
doc.php页面function download(){
$filename = (string) $this->input->post('filename');
$path = (string) $this->input->post('path');
$path = '/home/gw/uploads/documents/'.$path;
header('Pragma: public');
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, max-age=0, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: post-check=0, pre-check=0', false);
header('Cache-Control: private');
header('Content-Transfer-Encoding: UTF-8');
header('Content-Disposition: attachment; filename='.$filename.'');
header('Content-Type: application/octet-stream; name="'.$filename.'"');
echo file_get_contents($path);
exit;
}public function add($seq='')
{
$data = array('info' => array(),'doc' =>array());
if(strlen($seq) > 0)
{
$document = Cl::get('Document');
try
{
$document->load($seq);
$data['info'] = array(
'document_files' => strlen($document['document_files']) > 0 ? json_decode($document['document_files'],true):'',
);
}
catch(Exception $e){}
}
$data['doc'] = Cl::get('Document');
$this->_layout("popup");
$this->_view($data);
}html页面
<form name="frm_document" action="" target="ifm" method="post" enctype="multipart/form-data" onsubmit="return false;">
<input type="hidden" name="filename" value="希望这里赋值{.filename}这个,但这个是下面获得的" />
<input type="hidden" name="path" value="希望这里赋值{.savename}这个,但这个是下面获得的" />
<table class="formTable">
<tbody> <tr>
<th>上传文件</th>
<td>
<!--{? count(info.document_files) >0 }-->
<input type="file" class="file" name="document_file[]" value="" style="height:27px;"/><br>
<input type="file" class="file" name="document_file[]" value="" style="height:27px;"/><br>
<input type="file" class="file" name="document_file[]" value="" style="height:27px;"/>
<!--{@ info.document_files}-->
<br><a class="download">{.filename}{.savename}</a> // 这里是通过php页面中的document_files获取到的,使用的是templete_
<!--{/}-->
<!--{/}-->JS 代码 $('.download').click(function(){
$('form[name=frm_document]').attr('action','/hr/doc/download');
$('form[name=frm_document]').submit();
});
<br><a class="download">{.filename}{.savename}</a>
<!--{/}--> $('.download').click(function(){
$('form[name=frm_document]').attr('action','/hr/doc/download');
$('form[name=frm_document]').submit();
});