Allow you to upload 1000 files at the same time (a) _php Foundation

Source: Internet
Author: User
Preliminary knowledge: Javascript, PHP (small)/perl (few)!
Test environment: Windows2000 + IIS5 + PHP (Win98 + PWS + PHP3 failure, estimated to be configured out of the problem)
Directory structure:
/cgi-bin/fileup.php (File receive)
/www/test/phpfileup.htm (file submission)
/www/test/tmp/(Default save directory)

Foreword: File uploads, simple and troublesome. Here is the Upload file Submission page, use this page you can not only generate 1000 upload file box (actually any number of 0~n), and can point out their save path respectively.
The file input box for the Submit page is named: File0,file1,... file100,... filen
The File path box for the Submit page is named: path0,path1,... path100,... pathn
Because the generation of the page is very simple, it is not explained here, two functions are defined with JavaScript, check () is used to submit the page, create () is used to generate the File upload box. If you have any better advice or have any questions please email:gearsoft@netease.com

Phpfileup.htm
--------------------------------------------------------
<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.frm1.submit ();
Document.body.innerhtml= "Uploading please wait!";
}

var i=0;
function Create () {
var sfrm = Document.frm1.innerHTML;
var icnt = Cnt.value;
for (j=0;j<icnt;j++)
{
SFRM = sfrm + "Please select File" +i+ "<input type=file name= ' file" +i+ "' class=ist>";
SFRM = sfrm + "path: <input type=text name= ' path" +i+ "' value= '. /www/test/tmp/' class=ist> ';
SFRM = sfrm + "<br>";
i++;
}
Document.frm1.innerHTML = sfrm;
Document.frm1.cnt.value=i;
}

</script>

<body class=lbtn onload= "Document.frm1.cnt.value=cnt.value;" >
Please enter the number of files to upload: <input type=text name=cnt value= "class=ist onchange=" "Document.frm1.cnt.value=this.value;" >
<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=" document.location.reload (); "Class=lbtn>

<form name=frm1 method= "POST" enctype= "Multipart/form-data" action= ". /.. /cgi-bin/fileup.php ">
<input type=hidden name=cnt value= "class=ist>"
</form>

<input Type=button name=bt1 value= "Upload" onclick= "check ();" Class=lbtn>
<input Type=button name=bt1 value= "Clear onclick=" document.location.reload (); "Class=lbtn>
</body>
-------------------------------------------------------------------
adjourned

"This article copyright belongs to the author Gearsoft and Osso Nets jointly owned, if need to reprint, please specify the author and source"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.