Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Mar 2007
    Location
    hoooooooonnnnnnnnnnnnn
    Posts
    4

    Question image uploading problem

    Hi,

    I m developing an appl on J2ME + ASP/SQL Server.
    I m coding to read the image file (.jpg/.bmp) from phone file system and wants uploading it using HTTPConnection, with .asp page to handle the uploading part furthur.
    I m just reading the image file with FileConnection into the chunks of 1024 byte array and writing it through DataOutputStream. In first write I m writing file name i.e. xxx.jpg and "|" seperator. Then I m writing the image byte content chunk in loop.
    On server side my asp page handles the part. Asp reads the content requested with POST request method. it gets file name part but it doesn't read the image content byte data. I receive HTTP Content_Length as 0 or -1.
    Also I developed 1 servlet that do the same task as asp page. It works fine and also receives each and full data sent.

    If anybody can make me out of the problem. In asp page I m not able to read the image content byte data.

    It's very urgent as I have already crossed the timeline.
    :mad:pinkVagabond
    +919418088477

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    38

    Re: image uploading problem

    hi,

    i also have the same problem.. what phone are you using?
    also, this might be of help to you.. please let me know how it turns out..

    http://discussion.forum.nokia.com/fo...d.php?t=109549

    thanks

  3. #3
    Nokia Developer Expert
    Join Date
    Jun 2005
    Posts
    923

    Re: image uploading problem

    Also I developed 1 servlet that do the same task as asp page. It works fine and also receives each and full data sent.
    I assume you're using raw I/O streams with your servlet, that means, getting request.getInputStream() or something like that, right? That works, according to you.

    The chances it will work with your ASP page are slim, basically because Java and .NET may represent binary streams differently, so there would be some data loss along the way. Example: DataInputStream.readInt() reads the value "-1" fine, while an equivalent method in ASP may consider "-1" as EOF. The safest way for you is to encode your image to Base64, which ensure no data loss, as it's being transferred as a String.

    Daniel

  4. #4
    Registered User
    Join Date
    Mar 2007
    Location
    hoooooooonnnnnnnnnnnnn
    Posts
    4

    Unhappy Re: image uploading problem

    You are right that I use request.get...() in servlet.
    but actuallyI had to do this backen work through ASP. Servlet was only a test done to check whether the posted data was received at server or not.

    But after some debugging, I found that if I write the image data lengthmore than 2000 bytes then the content length at server side received is -1. If the image byte array written through HTTP_POST and dataOutputstream() is less than 2000, then the data received at server script (ASP) is fine. I mean if the image bytes written over HTTPConnection is more than 2000 bytes than the received content length is -1 else correct.

    please make me with some solution.
    I m not getting any work out of the same.
    :mad:pinkVagabond
    +919418088477

Similar Threads

  1. Image opactiy problem N71, N80 (getRGB loses alpha)
    By angeldt in forum Mobile Java Media (Graphics & Sounds)
    Replies: 5
    Last Post: 2010-01-27, 13:24
  2. Binary Image problem
    By vishaljaiswal in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2007-05-16, 09:26
  3. image input element types in form -problem
    By seanos11 in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2004-11-01, 16:25
  4. 7650 Image Uploader strange problem
    By kamlesh_in in forum Symbian
    Replies: 1
    Last Post: 2003-08-25, 15:06

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×