Home  >  Article  >  Backend Development  >  Example of multiple file upload_PHP tutorial

Example of multiple file upload_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:08:20887browse


Example of multiple file upload //upload_html.php------------------------------------------------ ---------------------------------------------


Upload file

<script> <br>function beforesubmit(forma) <br>{ <br> var indexnamea=forma.indexname.value; <br> var upfilea=forma.upfile.value; <br> var k=/ /g; <br> var indexnamea=indexnamea.replace(k," "); <br> var upfilea=upfilea.replace(k,""); <br> if(indexnamea=="" <br> upfilea=="") <br> { <br> alert("Directory name Or the uploaded directory cannot be empty!"); <br> return false; <br> } <br> return true; <br>} <br></script>



n";




for($i=1;$i< 8;$i++)
{
$upfile="upfile".strval($i);
echo " n";
echo " n";
echo " n";
}
?>


Uploaded files





//------------ -------------------------------------------------- -------------------------------------------------- -------

//upload.php-------------------------------- -------------------------------------------------- -----------------------------
//upload_path: The directory path to which the file is to be uploaded
for($i=1;$i<8;$i++)
{
$upfile="upfile".strval($i);
if(chop($$indexname)!=" " and chop($$upfile)!="")
{
$upfilename=($upfile."_name");
$filename=upload_path.$$upfilename;
$copyfile = copy($$upfile,$filename); If (!$copyfile)
die("File upload failed!");
$ls_file.=$$upfilename."n";
$flag=1; {
$ls_msg="No file uploaded, please select again!";
}
echo "n" ;
echo "n" ;
echo "n" ;
echo "n" ;
echo $ls_msg."n";
echo "n" ;
echo "n" ;
?>



http://www.bkjia.com/PHPjc/314784.html

www.bkjia.com

true

http: //www.bkjia.com/PHPjc/314784.html

TechArticle

Example of multiple file upload //upload_html.php---------------- -------------------------------------------------- ----------------------------- HTML HEAD TITLE Upload file/TITLE /HEAD scrip...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn