Jump to content


Photo

PHP Directory Handling -- Videos : NEED HELP


  • Please log in to reply
6 replies to this topic

#1 techiefreak05

techiefreak05
  • Members
  • PipPipPip
  • Advanced Member
  • 494 posts
  • LocationER, MN

Posted 30 July 2006 - 08:53 AM

Hello, I am going to offer a video hosting service on my site, similiar to Google Video. I was wondering how I could handle the directory of the videos, like when a user uploads a video, it uploads it into "/uploads/videos", and when a user goes to "uploads/videos" it has a list of all the vidoes uploaded(like the user that uploaded that file, date uploaded, etc..).... instead of the regular directory view thingy... Thanks for your help!!

--Brenden
Link shortener with advanced, detailed statistics:

http://tyny.us/

#2 techiefreak05

techiefreak05
  • Members
  • PipPipPip
  • Advanced Member
  • 494 posts
  • LocationER, MN

Posted 30 July 2006 - 10:10 AM

*bump*

Anyone?? anyone at all? Well, yeah I guess it IS 5 AM .. so I really shouldnt expect too much replies.. :)
Link shortener with advanced, detailed statistics:

http://tyny.us/

#3 para11ax

para11ax
  • Members
  • PipPip
  • Member
  • 21 posts
  • LocationColumbus, OH

Posted 30 July 2006 - 11:26 PM

Do you have a database that you can use for this?  Or are you already logging the uploads to some sort of file.  If you don't have a database you can use a file to log the uploads, but that could eat away at page load times.

The basic method I would use in this case is to start by creating an "index.php" page in the video upload directory.  That way when a person goes to that folder they will see that page instead of a file list.  Since I don't know your situation I'll finish off with a quick overview of the rest of the method until you provide the rest of the details:

There are two ways to do this depending on if you only want to show files with info or if you want to show all files and include info if possible.  The former would simple require you to pull all rows from the database and list them out.  That will give a list of all files that are currently logged as uploaded.  The latter would use scandir() to get a filelist, and then for each file, query the database (the filename would be the primary key), and if a row is returned, output that info.  Otherwise it is a file with no info and you can simply display a link and output "No Info".  There are some other combinations of these methods that would produce other effects.  Let me know what your situation is and how you are looking to make it work and I can detail a specific method further.

#4 techiefreak05

techiefreak05
  • Members
  • PipPipPip
  • Advanced Member
  • 494 posts
  • LocationER, MN

Posted 31 July 2006 - 03:23 AM

I dont have a database.. but if I should. then I will, I mean people will just upload videos to my site and it will automatically be displayed at the index.php in the video uploads folder...with a link to that video..
Link shortener with advanced, detailed statistics:

http://tyny.us/

#5 Drumminxx

Drumminxx
  • Members
  • PipPipPip
  • Advanced Member
  • 92 posts
  • LocationUSA

Posted 31 July 2006 - 03:38 AM

you could write a function to scan a directory for videos, I've used this one in the past, feel free to edit to your needs, this one return all the flv files which are flash video

function getVideos() {

	$path = $_ENV['DOCUMENT_ROOT'];
	$d = $path.'/videos/';
	$dir = opendir($d);
	while ($f = readdir($dir)) {
	 if (eregi("\.flv",$f))
			$files[]=$f;
	}
	return $files;
}

:: gucci.com ::
:: blockbuster.com ::

--------------------

#6 techiefreak05

techiefreak05
  • Members
  • PipPipPip
  • Advanced Member
  • 494 posts
  • LocationER, MN

Posted 31 July 2006 - 07:38 AM

Thanks!! Well, now how do I get a new window to pop-up when a link to a movie is clicked? The window will have the video file and play it.
Link shortener with advanced, detailed statistics:

http://tyny.us/

#7 techiefreak05

techiefreak05
  • Members
  • PipPipPip
  • Advanced Member
  • 494 posts
  • LocationER, MN

Posted 31 July 2006 - 07:55 AM

Another thing, how do I get a ranking thing on that pop-up window where the video plays? Like, my rating code will automatically appear on every video page.


Link shortener with advanced, detailed statistics:

http://tyny.us/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users