Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 486857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:32:45+00:00 2026-05-13T01:32:45+00:00

I upload a file from a Nokia N97 phone to server, everything works fine

  • 0

I upload a file from a Nokia N97 phone to server, everything works fine but after file is uploaded I want to get response from server. The problem is that I get response only after half a minute or more. From what I see the code blocks in httpConnection.getResponseCode() waiting for response. I tested it on a Sony Ericsson and I get response very fast so I assume is a Nokia N97 problem. (is not a server problem because it works fine on other phones)

Does anyone knows why this thing happens only on Nokia?

Here is a code snippet:

public uploadFile() {

       httpConn = (HttpsConnection) Connector.open(url, Connector.READ_WRITE);
        ...
       //set httpConn parameters and request method 
       ...

       writeParametersAndFileName(os, "text/plain");


       **writeFileToStream(os);** 

       os.write("\r\n".getBytes());
       os.write("--".getBytes());

       os.write(boundary.getBytes());

       os.write("--".getBytes());
       os.write("\r\n".getBytes());

        *//here code blocks on Nokia N97. Same thing happens if I use os.flush() after
        // I send chunks of the file*
         .....
        codeResp = httpConn.getResponseCode();
        // check condition
        checkResponseHeader();

}

public writeFileToStream() {

        InputStream is = null;
        FileConnection c = null;
        try
        {
           c = (FileConnection) Connector.open("file:///"+ sourcePath, Connector.READ);

           if(c.exists()) {
               is = c.openInputStream();

               long fs = c.fileSize();
               while (total < fs) {
                    byte[] data = new byte[512];
                    int readAmount = is.read(data,0,512);                       
                    total += readAmount;
                    os.write(data, 0, readAmount);


            }

            //os.flush();
        }
        catch (IOException ex) {
           //               
        }
        finally
        {
           //close connection

        }

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T01:32:46+00:00Added an answer on May 13, 2026 at 1:32 am

    You only think your file has been uploaded.

    Your call to getResponseCode() is the first one that causes the HttpConnection to actually connect to the server.

    It won’t return until it uploads the file, which presumably takes more than a minute.

    This is perfectly valid behavior according to the HttpConnection specification in JSR-118:

    ”
    The following methods cause the transition to the Connected state when the connection is in Setup state.

    * openInputStream
    * openDataInputStream
    * getLength
    * getType
    * getEncoding
    * getHeaderField
    * getResponseCode
    * getResponseMessage
    * getHeaderFieldInt
    * getHeaderFieldDate
    * getExpiration
    * getDate
    * getLastModified
    * getHeaderField
    * getHeaderFieldKey 
    

    “

    I expect the other phones you have tried this on are less powerful than the N97 and need to flush the OutputStream, therefore connecting to the server before they should according to the specification.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using JSch library to upload file from sdcard to SFTP server but
In my application I want to upload file from SD card to my server.
I'm implementing a file upload feature, and want to pass the uploaded file from
I want to upload file from my system to remote server as ftp.how i
I want to upload file from one server to another FTP server and following
I'm trying to upload a huge file from my Nokia N95 mobile to my
I'd like to upload a file from a client machine to my server. The
I need to continuously upload a generated file from Azure to client's FTP but
I want to upload a file from a web application. The web application calls
How can i prevent uploaded file from being executed? For example, someone could upload

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.