Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,665 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,166 people online right now. Registration is fast and FREE... Join Now!




Uploading Videos To Mysql

 
Reply to this topicStart new topic

Uploading Videos To Mysql

Pradeepk
post 6 Jul, 2007 - 03:51 AM
Post #1


New D.I.C Head

*
Joined: 22 Jun, 2007
Posts: 20


My Contributions



How to upload video(>3mb) trailers using PHP into MYSQL database.....and how to embed the uploaded video into the browser?
User is offlineProfile CardPM

Go to the top of the page

skyhawk133
post 6 Jul, 2007 - 07:29 AM
Post #2


Head DIC Head

Group Icon
Joined: 17 Mar, 2001
Posts: 14,846



Thanked 45 times

Dream Kudos: 1650

Expert In: Web Development

My Contributions


First question... why do you want to put them in a database and not just upload them to the server? Putting that much binary data in a database creates a lot of bloat.
User is offlineProfile CardPM

Go to the top of the page

serializer
post 7 Jul, 2007 - 12:36 PM
Post #3


D.I.C Head

**
Joined: 25 Jun, 2007
Posts: 108


My Contributions


QUOTE(Pradeepk @ 6 Jul, 2007 - 04:51 AM) *

How to upload video(>3mb) trailers using PHP into MYSQL database.....and how to embed the uploaded video into the browser?


1. Use an HTTP upload, encode the video file, save it to the filesystem and record the file location in the database
2. Google ffmpeg or on2flix for server-side encoding libraries
3. Get yerself a copy of Flash and build a media player

--serializer
User is offlineProfile CardPM

Go to the top of the page

skyhawk133
post 7 Jul, 2007 - 12:37 PM
Post #4


Head DIC Head

Group Icon
Joined: 17 Mar, 2001
Posts: 14,846



Thanked 45 times

Dream Kudos: 1650

Expert In: Web Development

My Contributions


QUOTE(serializer @ 7 Jul, 2007 - 02:36 PM) *

QUOTE(Pradeepk @ 6 Jul, 2007 - 04:51 AM) *

How to upload video(>3mb) trailers using PHP into MYSQL database.....and how to embed the uploaded video into the browser?


1. Use an HTTP upload, encode the video file, save it to the filesystem and record the file location in the database
2. Google ffmpeg or on2flix for server-side encoding libraries
3. Get yerself a copy of Flash and build a media player

--serializer


Excellent info, and I agree on storing the location, not the file itself in the database.
User is offlineProfile CardPM

Go to the top of the page

Pradeepk
post 8 Jul, 2007 - 07:26 PM
Post #5


New D.I.C Head

*
Joined: 22 Jun, 2007
Posts: 20


My Contributions


as it takes time for research....would u mind sending me a sample code fro the same....
Thanks...... smile.gif
User is offlineProfile CardPM

Go to the top of the page

Pradeepk
post 9 Jul, 2007 - 01:35 AM
Post #6


New D.I.C Head

*
Joined: 22 Jun, 2007
Posts: 20


My Contributions


i have this code.....but it not inserting files having size more than 2mb.i have changed config settings

CODE
<?php
ini_set("upload_max_filesize","200M");
if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0)
{
$fileName = $_FILES['userfile']['name'];
$tmpName  = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];

$fp      = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content = addslashes($content);
fclose($fp);

if(!get_magic_quotes_gpc())
{
    $fileName = addslashes($fileName);
}


$link = mysql_connect("localhost", "root")
  or die ("Could not connect to MySQL");

mysql_select_db ("test")
  or die ("Could not select database");

$query = "INSERT INTO upload (name, size, type, content ) ".
"VALUES ('$fileName', '$fileSize', '$fileType', '$content')";

mysql_query($query) or die('Error, query failed');
//include 'library/closedb.php';
  mysql_close($link);
echo "<br>File $fileName uploaded<br>";
}


[mod edit] use the code tags before I kill you. mad.gif
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 05:48AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month