Home > 整站程序 > 帝国后台批量添加附件的方法

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

注意:这个方法只是让上传的附件入库到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']="文章已经插入到数据库";

 

Categories: 整站程序 Tags:
  1. September 30th, 2009 at 14:27 | #1

    好东西 感谢分享

  2. November 20th, 2009 at 09:02 | #2

    路过~~留痕

  1. No trackbacks yet.
Note: Commenter is allowed to use '@User+blank' to automatically notify your reply to other commenter. e.g, if ABC is one of commenter of this post, then write '@ABC '(exclude ') will automatically send your comment to ABC. Using '@all ' to notify all previous commenters. Be sure that the value of User should exactly match with commenter's name (case sensitive).