tags:

views:

77

answers:

1

Hi Everybody,

I create an application of user registration. When user registers in the application, I want to save the user data on an HTTP server. How can I do this?

Thanks Deepak Kumar

+2  A: 

You can store data on a remote server using networking. One example in this article.

Example of how to store a file on a remote server (from the article above):

File f = new File("/path/fileToUpload.txt");
HttpRequest request = new HttpRequest("http://host/some_path");
Part[] parts = { 
    new StringPart("param_name", "value"), 
    new FilePart(f.getName(), f) 
};
filePost.setEntity( new MultipartRequestEntity(parts, filePost.getParams()) );
HttpClient client = new HttpClient();
int status = client.executeMethod(filePost);
BennySkogberg
@BennySkogberg this answer is really helpful...But what about sending data to SQLite database by HTTP?
PM - Paresh Mayani
I did not try it. Hopefully it will work. Whether I have to store all the record to a File before sending it to the HTTP Server???
Deepak
@Paresh Mayani: There are already paid apps for storing on SQL-servers: http://www.androlib.com/android.application.com-quickdb-Fp.aspx. To build your own solution take a look at java.net: http://developer.android.com/reference/java/net/package-summary.html and android.net http://developer.android.com/reference/android/net/package-summary.html.In my view, a remote SQLite is a bit odd. SQLite is a tiny DBMS having its primary use in limited environments. Remote storage is better (and faster) with MySQL- or MS SQL-server. Hope this helps! Sincerely,
BennySkogberg
@Deepak: Not necessary. Your app should be used by more than one user, and each user than should transfer her/his own file to your remote server. Another way is to use a database (see comment above). Good Luck!
BennySkogberg