techiefreak05 Posted July 30, 2006 Share Posted July 30, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/16006-php-directory-handling-videos-need-help/ Share on other sites More sharing options...
techiefreak05 Posted July 30, 2006 Author Share Posted July 30, 2006 *bump*Anyone?? anyone at all? Well, yeah I guess it IS 5 AM .. so I really shouldnt expect too much replies.. :) Quote Link to comment https://forums.phpfreaks.com/topic/16006-php-directory-handling-videos-need-help/#findComment-65782 Share on other sites More sharing options...
para11ax Posted July 30, 2006 Share Posted July 30, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/16006-php-directory-handling-videos-need-help/#findComment-66161 Share on other sites More sharing options...
techiefreak05 Posted July 31, 2006 Author Share Posted July 31, 2006 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.. Quote Link to comment https://forums.phpfreaks.com/topic/16006-php-directory-handling-videos-need-help/#findComment-66211 Share on other sites More sharing options...
Drumminxx Posted July 31, 2006 Share Posted July 31, 2006 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[code]function getVideos() { $path = $_ENV['DOCUMENT_ROOT']; $d = $path.'/videos/'; $dir = opendir($d); while ($f = readdir($dir)) { if (eregi("\.flv",$f)) $files[]=$f; } return $files;}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/16006-php-directory-handling-videos-need-help/#findComment-66213 Share on other sites More sharing options...
techiefreak05 Posted July 31, 2006 Author Share Posted July 31, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/16006-php-directory-handling-videos-need-help/#findComment-66247 Share on other sites More sharing options...
techiefreak05 Posted July 31, 2006 Author Share Posted July 31, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/16006-php-directory-handling-videos-need-help/#findComment-66250 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.