Need some work done? Post a Project Today
I need a script that deals with the following:
- file upload (only txt files)
- Takes the uploaded file, and converts it to a tree
-- the uploaded file has about 100K+ lines, each line indented so example (where the + are tabs):
++ File 1
+++ Sub Cat
++++ File 4
++++ File 5
++ File 2
+ Category 2
++ SubCategory 1
+++ File 1
++ SubCategory 2
I need to be able to take each line, in the order it's given, and insert it into the database with the following schema: tree (`parent_id`, `position`, `left`, `right`, `level`, `title`, `type` ) (where the table is the jsTree table). So when it's inserted into the table and jsTree renders it on the site, the file that was uploaded is exactly what looks like on the site.
I also attached an example text file.