CodeIgniter Forums
How to read files and insert into DB - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: How to read files and insert into DB (/thread-62797.html)



How to read files and insert into DB - Gladiator_x - 08-27-2015

Hello ,

i have a folder contain around 4000 file , i wanna use a codeiginter to read all these files and then insert the filename and file contain to database table .

i create the database table like :

id
filename
filecontant

thanks


RE: How to read files and insert into DB - mwhitney - 08-27-2015

You could easily do this using the directory helper and the file helper, but unless you need to monitor this directory and keep it up to date as a long-term feature of a website, I'm not sure why you would bother going through CodeIgniter to do this, rather than just writing a one-time script.


RE: How to read files and insert into DB - freddy - 08-27-2015

(08-27-2015, 06:42 AM)Gladiator_x Wrote: Hello ,

i have a folder contain around 4000 file , i wanna use a codeiginter to read all these files and then insert the filename and file contain to database table .

i create the database table like :

id
filename
filecontant

thanks

what it does mean "contain to database table", let me guess do you have folder around 4000 file then you need to store file name and also file contain, is it such as articles which writing in m word, am i correct ! if yes it such as articles it will not handle by codignter you should create common CRUD write file name and copy paste your container to text are then submit it! hope fully my guess not wrong sorry if i'm wrong