-3

这段代码实际上可以正常工作,我没有问题,但是当我的领导要求我进行多次上传时,问题开始了,我的领导希望有 2 个上传按钮,这样当用户单击提交时,2 个文件将保存在服务器文件夹中。

索引aa.php

<?php
$smp_id = (int) @$_GET['i'];
$i = $db->get_row("select * from sample where smp_id='$smp_id'");
?>

    <form name="form" enctype="multipart/form-data" method="post" action="upload.php">
    <input type="hidden" name="smp_id" value="<? echo $smp_id ?>"/>
        <table class='generic'>
            <tr><td>Proposal Attachment</td><td><input type='file' name='file' value=''></td></tr>
            <tr><td>Proposal Attachment</td><td><input type='file' name='file1' value=''></td></tr>     
            <tr><td colspan='2'>
            <input type="submit" value="Submit" class="JSPOPUP_close">
            <input type="button" value="Close" class="JSPOPUP_close">
            </td></tr>
        </table>

    </form>

这行代码<tr><td>Proposal Attachment</td><td><input type='file' name='file1' value=''></td></tr>只需要添加它,这样我就有 2 个上传按钮。然后在upload.php中我添加了这一行$file1 = fs_upload($_FILES['file1']);来支持file1并且我添加了这个$sm_sql['presentation'] = $file1;以便file1名称将保存在我的示例表中,我忘记了什么吗?注意:不是多次上传时有效(仅限1个文件上传)

上传.php

<?
include("base_main.php");
$smp_id = (int) $_POST['smp_id'];

$file = fs_upload($_FILES['file']);
$file1 = fs_upload($_FILES['file1']);

$sm_sql['proposal'] = $file;
$sm_sql['presentation'] = $file1;

$insert = insertformat($sm_sql);
$query = $db->query("update sample set $insert where smp_id='$smp_id'");

if($query){
message_set("File uploaded: <a href='$fileserver_path/dex/$file'>$file</a>  <a href='$fileserver_path/dex/$file1'>$file1</a>");
goback();
}
?>

这是

错误:致命错误:无法在第 363 行重新声明 C:................................\class.upload.php 中的类上传

http://www.verot.net/download/class.upload.php/class.upload_0.25.txt的链接class.upload.php

4

1 回答 1

2

您在某处包含包含class upload两次的文件:

include 'class.upload.php';

据说它在fs_upload函数中的某个地方。

使用或代替仅包含文件一次require_onceinclude_onceinclude

于 2012-10-30T09:12:57.513 回答