1

I want to be able to have the user select an OPML file that contains a large number of bookmarks, then loop through each one and toss it in a mysql database.

Any direction would be much appreciated.

Daelan
  • 685
  • 4
  • 11
  • 24

1 Answers1

3

In the end, parsing any file comes down to a few things:

  • Get the file from $_FILES
    Handling File Uploads (Documentation)
  • Load the file into a reader
    SimpleXML (Documenation)
  • Check that it is in the right format
    (This will most likely just be checking that SimpleXML didn't throw an error)
  • Loop through the data
  • Sanitize any data going into the database
  • Enter it into the database

If this is a big file, you will also want to look it things like max_upload_size and other upload size restrictions. Also, look into a way to let the user know you are working if the script takes a while to process the file.

Hari K T
  • 4,174
  • 3
  • 32
  • 51
Tyler Carter
  • 60,743
  • 20
  • 130
  • 150