views:

12

answers:

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.

A: 

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.

You can use this question to entertain them while they are waiting.

Chacha102