Megabing213
Eternal Poster
- Joined
- Mar 18, 2018
- Posts
- 654
- Reaction
- 682
- Points
- 359
bat ayaw po nya mag upload nang video? pa fix po mga sir
database.
ctto.
index.php
db.php (database)
database.
ctto.
index.php
Code:
<!DOCTYPE html>
<html>
<head>
<title>video upload</title>
</head>
<body>
<h1><a href="video.php">VIDEOS</a></h1>
<form method="post" action="index.php" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" name="upload" value="UPLOAD">
</form>
</body>
</html>
<?php
include ('db.php');
if (isset($_POST['upload'])) {
$name = $_FILES['file']['name'];
$tmp = $_FILES['file']['tmp_name'];
move_uploaded_file($tmp, "videos/".$name);
$sql = "INSERT INTO videos (name) VALUES('$name)";
$res = mysqli_query($con,$sql);
if ($res ==1) {
echo "<h1>video inserted successfully</h1>";
}
}
?>
db.php (database)
Code:
<?php
$con = mysqli_connect('localhost','root','','vuad');
?>