Reputation: 31
In my iphone application i used sqlite3 for creating database. Now i want to take backup of a database file on my server.
so how to upload my sqlite db file to server from my application in iphone?
Upvotes: 3
Views: 1145
Reputation: 947
I would read the sql database into a JSON object, then upload it to a server via a URL that calls a PHP script along the lines of this stack overflow answer!
Here's an example of some mySQL data wrapped into JSON:
{database:{"col1":"56","col2":"85","col3":"some_text"},
{"col1":"57","col2":"86","col3":"next row"} }
More about JSON payloads in Apple dev docs here JSON
As of iOS5.x, Apple now includes some JSON helper classes, see NSJSONSerialization class reference along with the Twitter example app.
I have used this the SBJson framework in the past for iOS SBJson
Upvotes: 5