Home arrow PHP arrow Page 3 - Video Streaming PHP Script Tutorial

Upload video files and create a MySQL table - PHP

One of the most important features in a website is the ability to show videos to your visitors. There are a lot of video hosting solutions nowadays, with YouTube as the most popular. However, due to its popularity, there are lots of services -- even free services -- that let viewers download your video files after you've uploaded them to YouTube. If you need to restrict downloading of your files, keep reading.

  1. Video Streaming PHP Script Tutorial
  2. Design of the Application
  3. Upload video files and create a MySQL table
  4. The PHP script: Streamvideo.php
By: Codex-M
Rating: starstarstarstarstar / 34
January 27, 2010

print this article



Create a folder in your FTP server using a NOT so common name (the name of your pet maybe). And then upload your files to this folder. When it's done, create a new MySQL table consisting of the following three important fields:

1. id

2. realurl

3. videotitle

For security purposes, it is important restrict the number of characters in your field. Read the article at the link for some MySQL database design tips.

Your objective is to make sure that your MySQL table at least looks like the one below:

Create a page for your embedded content

Okay, now you have database tables for your ID and equivalent real URL video path. You will need to create a page where you will embed your content. Currently this is the one I use (replace with your own URL where appropriate):

<OBJECT id=WindowsMediaPlayer1 width=320 height=264 hspace=5

vspace=5 classid=clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6 border="5" align="middle">

<param name="URL" value="http://www.php-developer.org/streamthisvideo.php?ID=snN0CuN5WDwV26331loq8" ref>

<param name="rate" value="1">

<param name="balance" value="0">

<param name="currentPosition" value="0">

<param name="defaultFrame" value>

<param name="playCount" value="1">

<param name="autoStart" value="-1">

<param name="currentMarker" value="0">

<param name="invokeURLs" value="-1">

<param name="baseURL" value>

<param name="volume" value="50">

<param name="mute" value="0">

<param name="uiMode" value="full">

<param name="stretchToFit" value="-1">

<param name="windowlessVideo" value="0">

<param name="enabled" value="-1">

<param name="enableContextMenu" value="-1">

<param name="fullScreen" value="0">

<param name="SAMIStyle" value>

<param name="SAMILang" value>

<param name="SAMIFilename" value>

<param name="captioningID" value>

<param name="enableErrorDialogs" value="0">

<param name="_cx" value="9260">

<param name="_cy" value="9790">

<EMBED type='application/x-mplayer2'


id='mediaPlayer' name='mediaPlayer' displaysize='4' autosize='-1'

bgcolor='darkblue' showcontrols="true" showtracker='-1'

showdisplay='0' showstatusbar='-1' videoborder3d='-1' width="320" height="264"

src="http://www.php-developer.org/streamthisvideo.php?ID=snN0CuN5WDwV26331loq8" autostart="true" designtimesp='5311'>



Important: Do not forget to save the file with a .php extension.

>>> More PHP Articles          >>> More By Codex-M

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: