Hi Everyone,

I haven't started coding or anything but I need to know if it's possible to read a file from last read position? I want to read a file and dump the content into a MySQL database but don't want to read the entire file from start to end everytime I open it.

Is this possible in PHP?

Regards

Member Avatar for diafol

Yes, I suppose you can. You just have to decide where you want to keep the data about the last read position - in the DB too?

files:  id | filename | content | last_position

This should work if only one person is doing the reading. if however more than one person can read the same file...

files:  id | filename | content
read:   user_id | file_id | last_position (Compound PK on first 2 fields)

Hi Diafol,

Thanks for the feedback, at this stage it will be 1 person / cronjob only.

Regards

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.