SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Leicester
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Automated upload??

    Hi folks,

    Can anyone tell me if its possible to have PHP (via a cron job or some other method), monitor a files timestamp and when it sees that a new file has been uploaded, execute a function that uplaod the CSV data from that file inot a MySQL database?

    i created a function that lets me upload the CSV file manually into SQl but now my client needs it to be fully automated so that whenever teh ftp across an updated CSv file, it gets uploaded to teh database.

    have no idea how to go about this oen and would appreciate any help

    Cheers

    D.

  2. #2

    Join Date
    Oct 2003
    Location
    €uroLand
    Posts
    1,340
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, this shouldnt be too tricky. You just need to store the timestamp of the CSV file somewhere when you processed it and when your script is run again you compare this value with the current timestamp of the CSV file. If the file's timestamp is newer you simply copy the data into your database and update the stored timestamp.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •