Maaf nak tanya. Kenapa saya punya file upload xjadi. salah kat mana ya?
ni form
<!DOCTYPE html>
<html>
<body>
<form action=”upload.php” method=”post”>
Select image to upload:
<input type=”file” name=”fileToUpload” id=”fileToUpload”>
<input type=”submit” value=”Upload Image” name=”submit”>
</form>
</body>
</html>
ni upload.php
<?php
$target_dir = “uploads/”;
$target_file = $target_dir . basename($_FILES[“fileToUpload”][“name”]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
// Check if image file is a actual image or fake image
if(isset($_POST[“submit”])) {
$check = getimagesize($_FILES[“fileToUpload”][“tmp_name”]);
if($check !== false) {
echo “File is an image – “ . $check[“mime”] . “.”;
$uploadOk = 1;
} else {
echo “File is not an image.”;
$uploadOk = 0;
}
}
?>
saya dapat koding ni dari w3school tapi xmanjadi. Boleh tolong x? Please..
Kalau tengok ke form tu mcm missing ni je enctype=”multipart/form-data”
bt mcm ni
<form action=”upload.php” method=”post” enctype=”multipart/form-data”>
Cuba balik pastu respond kat sini jadi ke x.
aah betul lah.. hahahaha…. tertinggal yang ni.. patutlah xjadi. terima kasih boskur