Loading files into root directory folders in CodeIgniter. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Loading files into root directory folders in CodeIgniter. (/showthread.php?tid=74165) |
Loading files into root directory folders in CodeIgniter. - christaliise - 08-07-2019 I have 5 problems, the 5th is a potential problem. It is probably best to deal with one problem at a time. (1) The posted information does not load into the folders. I have tried deleting the country folder but it makes no difference. (2) If a different Username is used it declares an error that the Username exists. The is_unique function is not working. I have tried deleting the country folder but it makes no difference. (3) When the root folder is deleted the above errors are the same as when the folder exists. (4) I have tried to check if username exists in the members folder, as per the coding below but that coding doesn't work. (5) Will need to login when the information is loaded, using the Username & Password. Basically, the coding below was taken from another person's project, which worked, but I have changed things to suit my project and the difference with that other person's project and what I'm trying to do is that the Username and Password information was loaded into a database, whereas I don't want to use a database. In that other project the Certificate was loaded into a folder in the root directory the same as what I'm trying to do, but I also want to load the Username and Password into the root directory folders the same as the Certificate. Also in that other person's project there was no country folder. All of that maybe the cause of my problems but I don't know how to fix, despite studying the CI UserGuide. The coding below creates the folders in the root directory as expected and as follows. accounts/afghanistan/realname/username accounts/afghanistan/realname/password accounts/afghanistan/realname/certificate But no information or pdf files are entered. I would want the Username & Password information to be in PHP format. Controller PHP Code: public function youraccount() View PHP Code: <?php I want the information that is entered into the text boxes and the pdf file to be loaded into the root directory folders. UPDATE 08/08/19 I've changed this line- PHP Code: $config['upload_path'] = 'accounts/afghanistan/'.$youraccount->realname.'/certificate/'; To this- PHP Code: $config['upload_path'] = 'accounts/afghanistan/'.$realname.'/certificate/'; Now I have the pdf certificate loading into the folder. UPDATE 16/08/19 I've added the following to the above Controller script, but that shouldn't change the performance or add or reduce the problems. PHP Code: if(!is_dir('accounts')) I now get the accounts & country folders created and the "first" RealName folder is created and the Username, Password, and Certificate subfolders are created. And as I said in the last update the pdf certificate loads into the folder. But I now have 2 additional problems. (1) With is_unique enabled every additional RealName produces the error "already exists" when there is no other existing. (2) If I disable is_unique I can not create subsequent RealName folders, in other words "second" or "third" RealName folders. I have tried creating another Country folder which works but I can only use the "first" RealName. Or put another way if I use "John Doe" as the "first" RealName I can not use "Bill Smith" or "Joe Blog" as "second" or "third" RealNames as the folders will not create, but the "John Doe" folder will create and regardless of which country. Those 2 problems appear to be CodeIgniter bugs because I've tried numerous variations of coding. Or does somebody have the solution? Also, I need to learn how to transfer the contents of the text boxes into a PHP file. I guess there should be a template PHP file that is copied and then the text box content added, then the copied file loaded into the folders the same as the PDF file is loaded into the Certificate folder. Can that be done in CodeIgniter or maybe Javascript? |