May 11th, 2008

帝国后台批量添加附件的方法

Category: 整站程序, Author: humker, Popularity: 1%

注意:这个方法只是让上传的附件入库到enewsfile数据表,主要处理上传大文件的问题,小文件不用用它。 

修改enews.php

//删除目录文件
elseif($enews=="DelPathFile")
{
        $filename=$_POST['filename'];
        DelPathFile($filename,$logininid,$loginin);
}

后插入

//插入文件名到数据库
elseif($enews=="InsertPathFile")
{
        $filename=$_POST['filename'];
        InsertPathFile($filename,$logininid,$loginin,$classid);
}

查找“EditPrintTemp,DelPathFile,”在他后面加“InsertPathFile,”

在userfun.php文件中加入

function insertpathfile( $filename, $userid, $username,$classid,$xfile)
{
    global $empire;
    global $dbtbpre;
    checklevel( $userid, $username, $classid, "file" );
    $count = count( $filename );
    if ( empty( $count ) )
    {
        printerror( "NotFileid", "history.go(-1)" );
    }
    $i = 0;
    for ( ; $i < $count; ++$i )
    {
        if ( strstr( $filename[$i], ".." ) )
        {
        }
        else
        {
          $dfile = returnpathfile( $filename[$i] ); 
    $sql = $empire->query( "INSERT INTO `{$dbtbpre}enewsfile` VALUES (NULL,'$dfile', 315341, '$xfile', 'admin', '2007-12-12 15:48:59','$classid','$dfile', 1, 0, 17, 0, 1);" );
        }
    }
    insert_dolog( "" );
    printerror( "InsertDataBaseFileSuccess", $_SERVER['HTTP_REFERER'] );
}

将/admin/file/FilePath.php的文件结尾部分对照修改为下面的东西

<td height="25"><input type="submit" name="enews" id="enews" value="InsertPathFile"></td>
   <td ><input type="submit" name="enews" id="enews" value="DelPathFile"></td>
          <td height="25"><select name="classid" id="classid">
            <option value="0">所有栏目</option>
            <?=$do_class?>
          </select></td>
    <td><input type="text" id="xfile" name="xfile" value="文件路径" /></td>

开头部分添加

include("../../class/userfun.php");
$fcjsfile='../../data/fc/cmsclass.js';
$do_class=GetFcfiletext($fcjsfile);

删除掉

<input name="enews" type="hidden" id="enews" value="DelPathFile">

在e\data\language\gb\pub\message.php中添加

$message_r['InsertDataBaseFileSuccess']="文章已经插入到数据库";

 

相关文章

Tags:.
评论数量(0) | Add Comments
本文网址:http://www.humker.com/2008/05/11/ecms-insertfile/

There are No comments.

» You can leave a response or Trackback .

leave a reply