-3

このコードは実際に機能していますが、問題はありませんが、リーダーが複数のアップロードを行うように依頼すると、リーダーは2つのアップロードボタンを使用して、ユーザーが送信をクリックすると2つのファイルがサーバーフォルダーに保存されるようにします.

indexaa.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();
}
?>

これは

error: Fatal error: Cannot redeclare class upload in C:................................\class.upload.php 行 363

http://www.verot.net/download/class.upload.php/class.upload_0.25.txtのリンクclass.upload.php

4

1 に答える 1

2

class upload2回を含むファイルをどこかに含めています:

include 'class.upload.php';

おそらくそれはfs_upload関数のどこかにあります。

の代わりにまたはを使用して、ファイルを一度だけ含めます。require_onceinclude_onceinclude

于 2012-10-30T09:12:57.513 に答える