Upload Video Form in PHP

Submitted by: 
Visitors have accessed this post 18949 times.

In this simple project you can learn how to upload a video, store it to your database and play video. The users can only upload a video format in mpg, wma, mov, flv, mp4, avi, qt, wmv, and rm. The maximum video file size to be upload is 10mb. This project is created using PHP in PDO query.

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.


@Jeprox - thanks for this great script. Happy to say I have it working on the homepage of my domain @ promodrone(dot)com. Have figured out how to increase the submission size limits and it's working like a champ! I'd been looking for this for quite awhile when I realized I'd downloaded it months ago and was sitting my downloads folder (lol!). Glad I found this, it'a a perfect way to give your users the chance to publish small, promo videos and keep all content onsite. Also managed to split up the script so that the upload panel is behind a secured Users' page and the video modal lives out front in the public area. Thanks again for this great work!

@Sachhidanand Gupta & Mari Guna - you would increase the size of submitted video in the line: $size = $_FILES['file']['size'] /1024/1024; - add 3 more /1024 if you want to increase the video size to 5MB. For each target video size, add another /1024 to the end of the $size variable (each 1024 represents a megabyte). I was really stumped by this until a trip to Stack Overflow cleared up the confusion. Hope this helps...

mmm have searched long

in php.ini change to:
post_max_size = 500M
upload_max_filesize = 500M

Very good, there is an Open source video sharing written in PHP.

Website: youphptube.com/
Download : github.com/DanielnetoDotCom/YouPHPTube
Demo : demo.youphptube.com/
Tutorials: tutorials.youphptube.com

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.