if (move_uploaded_file($file["tmp_name"], StackConst::res_file_url() . $down_urlname)) { //装填信息 $arrFileInfo = array("down_name" => @$_POST['down_name'], "down_urlname" => $down_urlname, "down_savedate" => StackConst::get_date()); //引入FileDao require_once '../dao/FileDao.php'; //实例化FileDao $fileDao = new FileDao(); if ($fileDao->addFileSource($arrFileInfo)) { echo "文件上传成功!"; StackConst::jump_page("../view/filelist.php"); } else { echo "文件上传失败!"; } } else { echo "文件上传失败!"; } } } else { if ("deleteFile" == $type) { //引入FileDao require_once '../dao/FileDao.php'; //实例化FileDao $fileDao = new FileDao(); if ($fileDao->deleteFileById(@$_GET['down_id'])) { echo "文件资源删除成功!"; StackConst::jump_page("../view/filelist.php"); } else { echo "文件资源删除失败!"; } } }
<?php //引入静态常量 require_once '../../../util/StackConst.php'; //引入FileDao require_once '../dao/FileDao.php'; //实例化FileDao $fileDao = new FileDao(); //获取File集合 $arrFiles = $fileDao->getFileList(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../zjs/pixelmatrix/css/uniform.default.css" type="text/css" media="screen"> <script language="javascript" type="text/javascript" src="../zjs/jquery-1.8.3.js"></script> <script language="javascript" type="text/javascript" src="../zjs/pixelmatrix/jquery.uniform.js"></script> <script language="javascript" type="text/javascript" src="../zjs/fzw_ht.js" charset="utf-8"></script> <title>文件资源管理</title> </head> <body> <table border="1" width="100%"> <tr align="center"> <th>序号</th> <th>文件名称</th> <th>文件地址</th> <th>保存日期</th> <th>下载文件</th> <th>操作</th>
/** * 获取资源文件列表 * * @return ResDownList */ public function getResDownList() { require_once '../../resourcefile/dao/FileDao.php'; $fileDao = new FileDao(); return $fileDao->getFileList(); }