Create fileupload1.php
This commit is contained in:
parent
53af016086
commit
38a946c065
24
FileUpload/fileupload1.php
Normal file
24
FileUpload/fileupload1.php
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<form action="" method="post" enctype="multipart/form-data">
|
||||||
|
Select image ->
|
||||||
|
<input type="file" name="file" id="file">
|
||||||
|
<hr>
|
||||||
|
<input type="submit" value="Submit" name="submit">
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Check if image file is a actual image or fake image
|
||||||
|
if(isset($_POST["submit"])) {
|
||||||
|
$target_dir = "uploads/";
|
||||||
|
$target_file = $target_dir . basename($_FILES["file"]["name"]);
|
||||||
|
|
||||||
|
move_uploaded_file($_FILES["file"]["tmp_name"], $target_file);
|
||||||
|
echo "File uploaded /uploads/".$_FILES["file"]["name"];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user