Silahkan Cari yang anda inginkan

Thursday 25 July 2013

2. Multiple Upload File

Sekarang kita lihat contoh upload file lebi dari satu sekaligus, untuk itu kita harus membuat nama input form bertipe array, contoh :
<form action="uploadfile.php" method="post" enctype="multipart/form-data">
<p>File yang diupload:<br>
<input type="file" name="fileku[]" /><br>
<input type="file" name="fileku[]" /><br>
<input type="file" name="fileku[]" /><br>
<input type="file" name="fileku[]" /><br>
<input type="file" name="fileku[]" /><br>
<input type="file" name="fileku[]" /><br>
<input type="file" name="fileku[]" /><br>
<input type="submit" value="Send" />
</p>
</form>
uploadfile.php
<?php
$direktori = ".";
foreach ($_FILES["fileku"]["error"] as $key => $error) {
    if ($error == UPLOAD_ERR_OK) {
        $tmp_name = $_FILES["fileku"]["tmp_name"][$key];
        $name = $_FILES["fileku"]["name"][$key];
        move_uploaded_file($tmp_name, $direktori."/".$name);
        echo "File $name berhasil diupload <br>";
    }
}
?>

No comments :

Post a Comment

Silahkan berkomentar dengan baik dan sopan, komentar anda berharga bagi saya...oke browww

No comments :

Post a Comment

Silahkan berkomentar dengan baik dan sopan, komentar anda berharga bagi saya...oke browww

SMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNGSMKN 1 BOJONGPICUNG