johnyjj2
09-25-2009, 01:32 PM
Hello :-)!
Summary: I'd like to send text file from MIDlet on mobile phone to PHP on server. There's problem with method encode(java.lang.String) in MIDlet. I can post code of MIDlet, if needed.
------- MIDlet ----------
I want to create MIDlet, which can send with the use of POST method and httpconnect little text file (or just string variable) to the server. The server would receive this file (or string) with the use of php.
Unfortunately, MIDlet doesn't compile in Wireless Toolkit 2.5.2_01 for CLDC. There is error about encode function, which changes string variable to the format allowed by httpconnection:
C:\Documents and Settings\MainAccount\j2mewtk\2.5.2\apps\myMidletSe ndData\src\myMidletSendData.java:90: cannot find symbol
symbol : method encode(java.lang.String)
location: class myMidletSendData
String encodedData = encode( rawData ); // user-supplied
^
I guess it may be problem with includes. This is what I've got:
import java.io.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
-------- PHP ------
The other question is about PHP. I've got book about PHP and example how to create file php which contains form responsible for sending file from computer in web navigator to server. I also have got code responsible for receiving this file (from directory where there are stored temporarily stored files received by the server).
In my case it is not web browser (like IE or MF) which sends the file, but MIlet. I guess it is not big difference because in both cases files received by server are stored in temporary folder. However I don't know how to know name of variable connected with the received file. In the case of sending from web browser to server this name is used both in php responsible for sending and receiving:
File in web browser:
Load this file:<input name="usersfile" type="file">
File to receive:
&usersfile = $HTTP_POST_FILES['usersfile']['tmp_name'];
In MIDlet:
HttpConnection conn = null;
String url = "http://87.205.xx.xx/datareceiver.php";
In the case of MIDlet sending it to server, I don't know how php on server should know name of this file.
Greetings :-)!
Summary: I'd like to send text file from MIDlet on mobile phone to PHP on server. There's problem with method encode(java.lang.String) in MIDlet. I can post code of MIDlet, if needed.
------- MIDlet ----------
I want to create MIDlet, which can send with the use of POST method and httpconnect little text file (or just string variable) to the server. The server would receive this file (or string) with the use of php.
Unfortunately, MIDlet doesn't compile in Wireless Toolkit 2.5.2_01 for CLDC. There is error about encode function, which changes string variable to the format allowed by httpconnection:
C:\Documents and Settings\MainAccount\j2mewtk\2.5.2\apps\myMidletSe ndData\src\myMidletSendData.java:90: cannot find symbol
symbol : method encode(java.lang.String)
location: class myMidletSendData
String encodedData = encode( rawData ); // user-supplied
^
I guess it may be problem with includes. This is what I've got:
import java.io.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
-------- PHP ------
The other question is about PHP. I've got book about PHP and example how to create file php which contains form responsible for sending file from computer in web navigator to server. I also have got code responsible for receiving this file (from directory where there are stored temporarily stored files received by the server).
In my case it is not web browser (like IE or MF) which sends the file, but MIlet. I guess it is not big difference because in both cases files received by server are stored in temporary folder. However I don't know how to know name of variable connected with the received file. In the case of sending from web browser to server this name is used both in php responsible for sending and receiving:
File in web browser:
Load this file:<input name="usersfile" type="file">
File to receive:
&usersfile = $HTTP_POST_FILES['usersfile']['tmp_name'];
In MIDlet:
HttpConnection conn = null;
String url = "http://87.205.xx.xx/datareceiver.php";
In the case of MIDlet sending it to server, I don't know how php on server should know name of this file.
Greetings :-)!