How to create a directory/folder when I create a category? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: How to create a directory/folder when I create a category? (/showthread.php?tid=25845) |
How to create a directory/folder when I create a category? - El Forum - 12-28-2009 [eluser]shinokada[/eluser] I have the following controller. Code: class Categories extends Controller { When I create a new category, I want to add to create a directory with the name of input IF it does not exist in the image directory. I guess I need to use the Directory helper and mkdir() with IF statement. Can anyone direct me how to do it please? How to create a directory/folder when I create a category? - El Forum - 12-28-2009 [eluser]rogierb[/eluser] I created a helper function create_path() for creating folders. Since I use this a lot and mostly on several directories (/www/some_dir/another_dir/final_destination) it is recursive (wel kind of anyway...) Code: function create_path($folder) How to create a directory/folder when I create a category? - El Forum - 12-28-2009 [eluser]shinokada[/eluser] Isn't is_dir should be file_exists? How to create a directory/folder when I create a category? - El Forum - 12-28-2009 [eluser]shinokada[/eluser] Thanks rogierb. It works well. I wonder how I can specify a path to a uploading file. For example I have images/foler1, images/folder2, images/folder3, ... And I want to upload an image to different directory, folder1, folder2 or folder3 etc. Do I need to use File Uploading Class for this? |