Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Trusted Contributor
Posts: 224
Registered: ‎08-09-2011
My Device: 9550

404 Error

While Uploading image to server i am getting 404 error.. below the code 

 

 

connection = (HttpConnection) Connector
.open("http://TM/profileDetails/profileUpdateWithoutImage?pp=TM&email=sattt@zz.info&fullName=sathiraju&phone=7207356087&location=Hyderabad&h=Java%20Developer&department=Javadepartment&currentlyWorkingOn=currentlyWorkingOn&aboutme=aboutme&source=Ib&createOrupdate=Create");
connection.setRequestMethod(HttpConnection.POST);
connection
.setRequestProperty(
net.rim.device.api.io.http.HttpProtocolConstants.HEADER_CONTENT_TYPE,
"application /x-www-form-urlencoded");
byte[] postBytes = BitmapUtils
.readFile("http://www.google.com//ig/images/weather/sunny.gif");
/* encoder.toString().getBytes("UTF-8") */;
connection
.setRequestProperty(
net.rim.device.api.io.http.HttpProtocolConstants.HEADER_CONTENT_LENGTH,
Integer.toString(postBytes.length));
os = connection.openOutputStream();

os.write(postBytes);
os.flush();
os.close();

if (connection.getResponseCode() == javax.microedition.io.HttpConnection.HTTP_OK) {
is = connection.openInputStream();

String resut= "";
int ch;

while ((ch = is.read()) != -1) {
sb.append((char) ch);

}

 

 

 

i am getting 404 responce from  Stream. Can any one give the solution for this.. 

Developer
Posts: 16,578
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: 404 Error

404 means not found, most likely the url is wrong.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter