Welcome Guest, Not a member yet? Register   Sign In
get files from directory & store it in database
#1

[eluser]Brain Coder[/eluser]
hello every one

before every thing sorry for my English

but i have some questions and looking for some answers

i have start to build my website using the CI framework
the idea of this website is to showing "smiles" in categories and these smiles it should be very huge something like 1000 smiles and i want to put it in category

i was thinking in the easiest way to collect the smiles from there categories in the ftp from some directories then put it in the database now i need some of your help to make these idea work like that :

1-when build the category and store the name of it in the database dynamicly the system build a directory on the web-space
2-in the upload section all of the directory that i was built is showing in the view
3-the webmaster select the directory from drop down list then press on the button("after he was upload the smiles from the ftp programme")
4-the script now store all smiles in the database and rename all the files before storing in the database

all these steps are easy but the problem now in how to upload new files and rename , storing there files in the database without to make any change to the files that was all ready stored and renamed ?

is there any idea to make it work ?

thank you for reading Smile
#2

[eluser]TheFuzzy0ne[/eluser]
I don't quite understand why you need the database at all. Why not just use the directory structure directly, and be done with it?
#3

[eluser]Brain Coder[/eluser]
thank you for replay

i was thinking of this solution but i want to store the files name of smiles and make an anchor to the smiles until if this smiles are active or not without deleting the smiles from the ftp

i hope you are understanding me Smile
#4

[eluser]n0xie[/eluser]
You could just store the filename (+path if you have different directories) in the database with a boolean 'active'.
#5

[eluser]Brain Coder[/eluser]
yes thats right and i have thinking to make something like this

in the array that came from directory helper with the files name i have to add suffix like this

the number is randomly and the "_d" is the suffix
12454875_d.gif

now i want to look in the files name that have not this suffix then rename it and add the suffix and store it into database

with your experiance is that a good way to do what i looking for

and if this way is true is there any CI function in array helper to check on the name of the files contians is the array ?
#6

[eluser]n0xie[/eluser]
You could just iterate over your array. For each value check if it has a suffix. If not add it and add it to the database.




Theme © iAndrew 2016 - Forum software by © MyBB