![]() |
how to read files from the directory without get_filesnames() - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: how to read files from the directory without get_filesnames() (/showthread.php?tid=17914) |
how to read files from the directory without get_filesnames() - El Forum - 04-19-2009 [eluser]linderox[/eluser] I want to make a cool my own photogallery I want to upload to directory some image files and read directory with files to the database. But I have 2 problems: 1) get_filenames function reads files from the subdirectory folder (e.g. thumbs) and I get more than I want to get lines to my db. 2) I don't know how to add character $img_suffix to the place before type of the file. I want to read SomeImgFile.jpg and than automaticaly add to the database place of the thumbfile SomeImageFile_cr.jpg here is my code with my ideas.Can you help me to solve this problems or give me your ideas how to update my database with list of files. Code: function FillUpDatabaseWithPhoto($directory) here what i should get in my database. I have 12 files and thumb directory inside with 12 thumb files Code: 050sq.jpg 050sq_cr.jpg Code: 050sq.jpg 050sq.jpg_cr // added "_cr" to the end, but I need "_cr.jpg" how to read files from the directory without get_filesnames() - El Forum - 04-22-2009 [eluser]TheFuzzy0ne[/eluser] Why you need to use the suffix? Would putting the files in a directory named "cr" not suffice? how to read files from the directory without get_filesnames() - El Forum - 04-22-2009 [eluser]linderox[/eluser] i have to put files to a separate dir and I have to rename it by adding suffix how to read files from the directory without get_filesnames() - El Forum - 04-22-2009 [eluser]TheFuzzy0ne[/eluser] Here's how I would do it, although I can think of at least 10 more ways of doing it. Code: <?php |