Mobile phone to upload data to web
Hi,
I need help in following question.
I got a project that requires an establish of my mobile phone with the web and upload certain data file up to a remote server.
Currently I got few question.
1) Is it possible to write an application to establish an http connection and upload data?
2) What is the recommended solution and how or where should I start looking into.
Many Thks
TY
[431 byte] By [
dunno98a] at [2007-11-27 7:30:48]

# 1
What mobile phone are You talking about ?
It is no problem to establish connection and upload data. For HTTP connection JAVA code is.
try {
connection = (HttpConnection) Connector.open(url);
connection.setRequestMethod(HttpConnection.GET);
connection.setRequestProperty("User-Agent","Profile/MIDP-1.0 Configuration/CLDC-1.0");
connection.setRequestProperty("Content-Language", "en-UK");
connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
// long datum = connection.getDate();
out = connection.openOutputStream();
in = connection.openDataInputStream();
int ch;
while ( (ch = in.read()) != -1) {
stringBuffer.append( (char) ch);
}
String data = stringBuffer.toString();
System.out.println("Stranica :" + data);
}
url = PHP call (ex. www.test.com/test.php?param1=gfdds¶m2="zutikombi")
There are other types of connection FTP, Socket etc. and You can find their specs in class javax.microedition.io ...
Depending on amount of data for upload choose your connection type. I had a small amount of data (less than 1500 chars) so i am using a PHP call to internet script. (www. \....\ test.php?param1=""¶m2=3¶m3="anything")
PHP script saves the data into a database, or PHP scripts writes data to a file .. etc ...
# 4
I dont think FTP is necessary if were talking about stuff under 1 megabyte.
I transfer roughly equal amounts of data just fine using php and http-post.
There might be some trouble using php, depending how webserver running php is set up, you can read more about it from this post:
http://forum.java.sun.com/thread.jspa?threadID=778390