04-19-2010 05:10 AM - edited 04-19-2010 05:13 AM
I would to like to get some samples for file uploading to server if that perticular file is not present ,otherwise it should update that perticular file on server.
04-20-2010 01:50 AM
I am able to read the file but when i am writing it to the specified location,it does not write the contents.
Sample of code of how i am uploading the file.
I am trying it on a Simulator.
StreamConnection s = null;
s = (StreamConnection)Connector.open(url+filename,Conn
HttpConnection httpConn = (HttpConnection)s;
int status = httpConn.getResponseCode();
if (status == HttpConnection.HTTP_OK)
OutputStream os = (OutputStream)httpConn.openOutputStream();
catch (IOException e)
where data is a byte array.What is wrong in this code or is there some different way to upload file to server.
04-20-2010 04:12 AM
I'm guessing you are pretty new to the world of HTTP communication. I suggest you do some research on how it works.
IN this case, you should probably look at using an HTTP POST to send you data, there is a sample of an HTTP POST included with the API documentation for HttpConnection.
But you will need a matching Server component, that takes the POST data and writes it to a file. The BlackBerry is only one end of the pipe and there is nothing that is automatically at the other end to write the data. You have to create both ends.