Results 1 to 1 of 1

Thread: Uploading, displaying and playing videos.

  1. #1
    Join Date
    Jun 2017
    Location
    Bengaluru, Karnataka, India
    Posts
    15
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Post Uploading, displaying and playing videos.

    I wish to Upload, display and play videos in my website. Here I am able to upload video's url and id into my table. But the problem is video's name is not inserting into table. The video are not uploading into specified directory and I hope because of this Videos are not playing. Please help me to overcome these problems.

    My Code is:

    dashboard.php

    Code:
    <div class="row">
      <?php
    	$conn = mysqli_connect("localhost", "root", "", "videos") or die("Connection Server" . mysqli_error());
    	$query=mysqli_query($conn, "SELECT * FROM vid");
    	$id = (isset($_GET['id']) ? $_GET['id'] : '');
    	if(isset($_POST['submit']))
    	{
    	      echo "<br />".$id."has been uploaded";
    	}
      ?>
    <div>
    <h3>List Of Videos</h3><br />
      <?php
           $conn = mysqli_connect("localhost", "root", "", "videos") or die("Connection Server" . mysqli_error());
           $query=mysqli_query($conn, "SELECT * FROM vid");
           while($row=mysqli_fetch_assoc($query))
    	{
    	        $id = $row['id'];
    		$name = $row['name'];
    		$url = $row['url'];
    		echo "<a href='watch.php id=$id'>&nbsp;$id&nbsp;&nbsp;$name&nbsp;&nbsp;$url</a> <br />";
    	}
      ?>
    </div>
    
    index.php
    
    <?php
    	$conn = mysqli_connect("localhost", "root", "", "videos") or die("Connection Server" . mysqli_error());
    	if(isset($_POST['submit']))
    	{
    		$id = (isset($_FILES['file']['id']) ? $_FILES['file']['id'] : '');
    		$name = (isset($_FILES['file']['name']) ? $_FILES['file']['name'] : '');
    		$temp = (isset($_FILES['file']['tmp_name']) ? $_FILES['file']['tmp_name'] : '');
    		move_uploaded_file($temp,"uploaded/".$name);
    		$url = "127.0.0.1/PHP/video%20upload%20and%20playback/uploaded*​/…";
    		mysqli_query($conn, "INSERT INTO vid VALUE('$id','$name','$url') ");
    		header("location:dashboard.php");
    	}
    ?>
    
    watch.php
    
    <?php
    	$conn = mysqli_connect("localhost", "root", "", "videos") or die("Connection Server" . mysqli_error());
    ?>
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8" />
    <title>Watch videos</title>
    </head>
    <body>
    <?php
    $conn = mysqli_connect("localhost", "root", "", "videos") or die("Connection Server" . mysqli_error());
    	if(isset($_GET['id']))
    	{
    		$id=(isset($_GET['id']) ? $_GET['id'] : '');
    		$query=mysqli_query($conn, "SELECT * FROM vid WHERE id='$id'");
    		while($row=mysqli_fetch_assoc($query))
    		{
    			$id = $row['id'];
    			$name = $row['name'];
    			$url = $row['url'];   
    			echo "You are watching ".$name."<br />";
    			echo "<embed src='$id' width='560' height='315'></embed>";
    		}
    	}
    	else
    	{
    		echo "Error !";
    	}
    ?>
    </body>
    </html>
    Last edited by james438; 06-23-2017 at 06:43 AM. Reason: format

Similar Threads

  1. Using thumbnails for playing multiple YouTube videos
    By molendijk in forum Submit a DHTML or CSS code
    Replies: 4
    Last Post: 01-15-2015, 02:58 PM
  2. Playing 'watch_popup videos' using the YouTube Api for embedding videos
    By molendijk in forum Submit a DHTML or CSS code
    Replies: 1
    Last Post: 06-21-2013, 03:18 PM
  3. Video Gallery(videos are not displaying)
    By tpravioti in forum JavaScript
    Replies: 3
    Last Post: 10-27-2009, 02:19 PM
  4. playing videos
    By davidjmorin in forum JavaScript
    Replies: 1
    Last Post: 09-27-2007, 10:44 PM
  5. Displaying videos like...
    By KamaShin in forum JavaScript
    Replies: 1
    Last Post: 07-30-2007, 04:17 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •