2

テキスト入力のあるフォームに画像アップロード ボタンがありますが、ファイルをチェック、サイズ変更、アップロードするように設計されたスクリプトは、1 回のアップロード用に設計されています。

次のコードで foreach() を使用して、このスクリプトに各ファイルをフィードする方法はありますか?

if (($_FILES['file']['type'] != 'image/jpeg') && ($_FILES['file']['type'] != 'image/jpg') && ($_FILES['file']['type'] != 'image/pjpeg')) {
            echo "<script>alert('Images Must be in jpg format and under 2 Mb');\n";
            echo sprintf("window.location='add.php'");
            echo "</script>";
            include('no-ad-footer.php');
                } else {
                chdir('admin/photos'); 
                require_once('upload.php');
                chdir('../../');

        if ($up->ValidateUpload()) { 
                $node = new sqlNode();
                $node->table = "photos";
                $node->push("int","TypeID",$_POST['TypeID']);
                $node->push("int","ListingID",$ListingID);          
                $node->push("text","Location",$new_name);           
                $node->push("int","POrder",$_POST['POrder']);
                $node->push("defined","DateofUpload","NOW()");

                if(($result = $mysql->insert($node)) === false)
                    die('Unable to push photo details into table photos line 38');          
            } else {
                echo "<font color='red'>Unable to upload image</font>";
                }
        }
4

1 に答える 1