dennismonsewicz Posted March 26, 2008 Share Posted March 26, 2008 Is there anyway to have fread(), fopen(), or any other f functions to crawl a directory and grab the files and strip the name of the files and size of the files? Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted March 26, 2008 Author Share Posted March 26, 2008 if not using fread or any f functions then could this be achieved by doing anything else? BUMP Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted March 26, 2008 Author Share Posted March 26, 2008 bump Quote Link to comment Share on other sites More sharing options...
lordfrikk Posted March 26, 2008 Share Posted March 26, 2008 If you want to iterate through the directory's files, then you can do it this way: <?php $dir = dir("."); while ( $file = $dir->read() ) { // here goes the file handling code } ?> Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted March 26, 2008 Author Share Posted March 26, 2008 $dir = dir(".") -> is this where I put the path to my directory? and what kind of file handling code would i use? Quote Link to comment Share on other sites More sharing options...
lordfrikk Posted March 26, 2008 Share Posted March 26, 2008 Yes, that's where the directory path goes. Well you said something about stripping filenames and getting file sizes, so that's what I meant by "file handling". Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted March 26, 2008 Author Share Posted March 26, 2008 Gotcha. I found a tutorial online and I am going to use what you suggested. I also need to dump the filenames into a Database. I am basically creating a stock photo site but instead of having to upload each individual file i am trying to just dump all of the photos in respected DIRs and have a PHP file do the dirty work Quote Link to comment 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.