SoFunction
Updated on 2025-04-13

Let you upload 1,000 files at the same time (I)

Preparation knowledge: Javascript, PHP (small amount)/Perl (small amount)!
Test environment: Windows2000 + IIS5 + PHP  (Win98 + PWS + PHP3 failed, it is estimated that there is a configuration problem)
Directory structure:
/cgi-bin/ (File reception)
/www/test/ (file submission)
/www/test/tmp/ (default save directory)

Preface: Uploading files is simple and troublesome. Below is the submission page for uploading files. Using this page, you can not only generate 1,000 upload file boxes (actually any number of 0~n), but also indicate their saving paths separately.
The file input box of the submit page is named: file0, file1,...file100,...fileN
The file path box of the submit page is named: path0, path1,...path100,...pathN
Since the generation of the page is very simple, I won't explain it here. I use javascript to define two functions, check() is used to submit the page, and create() is used to generate the file upload box. If you have any better suggestions or have any questions please email: gearsoft@


--------------------------------------------------------
<html>
<head>
    <title></title>
        <style>
        .lbtn {font-family:verdana;font-size:10.5pt;}
        .ist  {font-family:verdana;font-size:14.8px;size:400}
    </style>

    <script LANGUAGE="javascript">
    function check(){
        document.();
        ="Uploading Please wait!";
    }

    var i=0;
    function create(){
      var sfrm = document.;
      var icnt = ;
      for(j=0;j<icnt;j++)
      {
sfrm = sfrm + "Please select file "+i+" <input type=file name='file"+i+"' class=ist>";
sfrm = sfrm + "&nbsp;Path: <input type=text name='path"+i+"' value='../www/test/tmp/' class=ist>";
        sfrm = sfrm + "<br>";
        i++;
      }
      document. = sfrm;
      document.=i;
    }

    </script>

</head>
<body class=lbtn onload="document.=;">
Please enter the number of files to be uploaded: <input type=text name=cnt value="10" class=ist onchange="document.=;">
<input type=button name=bt1 value="generate upload file box" onclick="create();" class=lbtn>
<input type=button name=bt1 value="upload" onclick="check();" class=lbtn>
<input type=button name=bt1 value="Clear" onclick="();" class=lbtn>

     <form name=frm1 method="post" Enctype="multipart/form-data" action="../../cgi-bin/">
     <input type=hidden name=cnt value="20" class=ist>
     </form>

<input type=button name=bt1 value="upload" onclick="check();" class=lbtn>
<input type=button name=bt1 value="Clear" onclick="();" class=lbtn>
</body>
</html>
-------------------------------------------------------------------
(to be continued)

[The copyright of this article is jointly owned by the author gearsoft and Aoso.com. If you need to reprint it, please indicate the author and source]