Adsense
Popular Posts
- MySQL workbench -"Could not decrypt password cache"
- peer review (3)
- PHP, dump varailbes in a format way
- "Unusual traffic from your computer network" from blogger
- Install APXS in Redhat Linux
- JavaScript, remove trailing insignificant zeros after toFixed function
- Update member directory
- Set Windows path command line
- JavaScript: add days to current date
- DataTable table order by numeric, not by text
Sunday, April 6, 2014
PHP, upload multiple files and progress bar
main.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<form action="upload.php" method="post" enctype="multipart/form-data">
<p><input type="file" name="file_array[]">
<input type="submit" value="Upload all files">
</form>
</body>
</html>
upload.php
<?php /
if(isset($_FILES['file_array'])){
$name_array = $_FILES['file_array']['name'];
$tmp_name_array = $_FILES['file_array']['tmp_name'];
$type_array = $_FILES['file_array']['type'];
$size_array = $_FILES['file_array']['size'];
$error_array = $_FILES['file_array']['error'];
for($i = 0; $i < count($tmp_name_array); $i++){
if(move_uploaded_file($tmp_name_array[$i], "test_uploads/".$name_array[$i]))
{ echo $name_array[$i]." upload is complete<br>"; }
else {
echo "move_uploaded_file function failed for ".$name_array[$i]."<br>"; } }
} ?>
About upload progress bar, reference:
File Upload Progress Bar Meter Tutorial HTML5 Ajax PHP
http://www.developphp.com/view.php?tid=1351
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment