PHPCMS开发

当前位置/ 首页/ V9教程/PHPCMS开发/ 正文

最新phpcms v9 表单添加文件上传字段单个文件(downfile)

最新phpcms v9 表单添加文件上传字段单个文件(downfile)

1.打开目录 ./phpcms/modules/content/fields/ ;把 文件夹downfile,拷贝到目录./phpcms/modules/formguide/fields/里面。

2.打开文件 ./phpcms/modules/formguide/fields/fields.inc.php ,在数组$fields添加值 'downfile'=>'文件上传';

3.打开文件./phpcms/languages/zh-cn/formguide.lang.php ,添加如下内容

$LANG['upload_soft']                                =        '上传文件';

 

4.修改form.inc.php文件

$string .= $str."<input type='text' name='info[$field]' id='$field' value='$value' class='input-text' style='width:80%'/>  <input type='button' class='button' onclick=\"javascript:flashupload('{$field}_downfield', '".L('attachment_upload')."','{$field}',submit_files,'{$upload_number},{$upload_allowext},{$isselectimage}','content','$this->catid','{$authkey}')\"/ value='".L('upload_soft')."'>";

改为

$string .= $str."<input type='text' name='info[$field]' id='$field' value='$value' class='input-text' style='width:80%'  readonly='readonly' />  <input type='button' class='button' onclick=\"javascript:flashupload('{$field}_downfield', '".L('attachment_upload')."','{$field}',submit_attachment,'{$upload_number},{$upload_allowext},{$isselectimage}','content','$this->catid','{$authkey}')\"/ value='".L('upload_soft')."'>";

5.删除 output.inc.php 这个文件,否则下载地址会一直输出数组
 
6.input.inc.php改为 
 
function downfile($field, $value) {
        return trim($value);
}
 
7.更新缓存添加字段就好
 
懒人下载:点击下载