Skip to content

Instantly share code, notes, and snippets.

@abdualrhman1410
Created December 11, 2012 13:06
Show Gist options
  • Save abdualrhman1410/4258431 to your computer and use it in GitHub Desktop.
Save abdualrhman1410/4258431 to your computer and use it in GitHub Desktop.
<form action="<?$_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">
<?
for($i=1;$i<=5;$i++){
echo "<input type='file' name='file_".$i."' /> <br>";
}
?>
<input type="submit" name="upload" />
</form>
<?
if($_POST['upload']){
for($i=1;$i<=5;$i++){
$dir="uploads/".$_FILES['file_'.$i]['name'];
if($_FILES['file_'.$i]['error']==0){
$move=move_uploaded_file($_FILES['file_'.$i]['tmp_name'], $dir);
if($move){
echo "uploaded file".$dir;
}else{
echo $_FILES['file_'.$i]['error'];
}
}else{
echo "no select file <br>";
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment