0% found this document useful (0 votes)
283 views2 pages

Multiple File Upload PHP and HTML

This document describes how to create a multiple file upload form using PHP and HTML. It includes code for a front-end HTML page with a table structure to display multiple file input fields. It also includes a PHP script called upload.php that will process the uploaded files upon form submission by moving each file to an upload folder and echoing a success message. The form allows up to 5 files to be selected and uploaded simultaneously.

Uploaded by

rajjis
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
283 views2 pages

Multiple File Upload PHP and HTML

This document describes how to create a multiple file upload form using PHP and HTML. It includes code for a front-end HTML page with a table structure to display multiple file input fields. It also includes a PHP script called upload.php that will process the uploaded files upon form submission by moving each file to an upload folder and echoing a success message. The form allows up to 5 files to be selected and uploaded simultaneously.

Uploaded by

rajjis
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Multiple File Upload – Using PHP and HTML

Front Html Page

<html >

<head>

<title>Multiple Upload Form</title>

</head>

<body>

<?php

$i=1;

$table="<table>";

$table.="<tr>";

$table.="<td><form method='POST' action='upload.php' enctype='multipart/form-


data'></td>";

$table.="</tr>";

while($i<=5)

$table.="<tr>";

$table.="<td><label>Upload File $i :</label></td>";

$table.="<td><input type='file' name='uploaded[]'></td>";

$table.="</tr>";

$i++;

$table.="<tr>";

$table.="<td><input type='Submit' value='Send File'></td>";

$table.="</tr>";
$table.="</table>";

echo ($table);

?>

</body>

</html>

PHP Script- Save this script as upload.php (you can change the SQL attributes
used in the file according to your convenience)

<?php

$target= "upload/";

foreach($_FILES['uploaded']['tmp_name'] as $k => $name)

$target= $target . basename($_FILES['uploaded']['name'][$k]);

move_uploaded_file($name,$target);

echo "File ".basename($_FILES['uploaded']['name'][$k])." was uploaded


successfully.<br>";

?>

You might also like