×

Discussion Board

Results 1 to 14 of 14
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    11

    Image upload form

    Hello, I want to upload images from a 3650 phone
    to an application server using an XHTML MP
    browsing application.

    Is image upload possible?
    How is form input type "image" used?
    Do I need to set the form ENCTYPE?

    This does not work:

    <form action="i.nvl" method="post" ENCTYPE="multipart/form-data">
    <input type="image" name="image"/>
    <input type="submit" name="upload" value="Upload"/>
    </form>

    Jaripekka

  2. #2
    Registered User
    Join Date
    Jun 2003
    Posts
    1

    image upload form

    I have the same problem.

    I would Like to use a WML form in a WAP page on our site to give peopl the option to send in photos from thier phone.

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    11
    It appears that file upload _is_ possible
    on certain XHTML-capable phones.
    This one _does_ work with a 7250i

    <form action="i.nvl" method="post" ENCTYPE="multipart/form-data">
    <input type="file" name="upfile"/>
    <input type="submit" name="upload" value="Upload"/>
    </form>

    This phone model has in it's XHTML feature list
    "Content (image & sound) Uploader, built-in browser menu "

    Jaripekka

  4. #4
    Registered User
    Join Date
    Jul 2003
    Posts
    2
    I can't upload files with my 7250i. I'm using similar form and php to store uploaded files. However print_r($_FILES) prints nothing. I don't know if this is a php problem or has my gsm operator somehow disabled the possibility to upload files. However I can upload <input type="text" name="textfield"> just fine.

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    11
    I am using server-side Java and com.oreilly.servlet package
    for handling the image uploads.
    I also had some problems in receiving files,
    and I had to make small adjustment to the servlet package
    so that it would be compatible with 7250i request.

    There was a small compatibility problem in com.oreilly.servlet that I fixed.
    The Content-Disposition has extra white space.
    Somewhere in the code an extra trim was needed.

    Content-Disposition: Form-Data;Name="upfile";Filename="Clip-art02.gif"

    There might be a similar compatibility problem with
    PHP also.

    Jaripekka

  6. #6
    Registered User
    Join Date
    Jul 2003
    Posts
    2
    Yeah php was the problem. I made a test page with cgi-perl and it worked fine.

  7. #7
    Registered User
    Join Date
    Nov 2003
    Location
    Dublin, Ireland
    Posts
    16
    Hi Jarips,

    I am also using server-side Java and com.oreilly.servlet package
    for handling the image uploads from a 7250i.


    You said "The Content-Disposition has extra white space.
    Somewhere in the code an extra trim was needed"

    Can you tell me where in the code I should put this extra trim. Could you post the syntax for this trim.

    I really appreciate your help,

    Regards,

    Conor :-)

  8. #8
    Registered User
    Join Date
    Mar 2003
    Posts
    11
    Sure, here is a fix to
    MultipartParser.java line 380 in
    package com.oreilly.servlet.multipart

    This fix is a workaround so that
    file upload works with a Nokia 7250i

    // added trim
    String disposition = line.substring(start + 21, end).trim();

    if (!disposition.equals("form-data")) {
    // this exception was thrown before the fix
    throw new IOException("Invalid content disposition: [" + disposition +
    "]");
    }

    Jaripekka

  9. #9
    Registered User
    Join Date
    Nov 2003
    Location
    Dublin, Ireland
    Posts
    16
    Hi Jarips,

    Thank you for getting back to me so quickly. Unfortunately I am using a com.oreilly.servlet package installed on a free servlet web space site called mycgiserver.com. I cannot edit MultipartParser.java line 380 !

    Can you think of another way to do this ? I have attached my code if this helps.

    Thank you once again for helping me out.

    Conor :-)

  10. #10
    Registered User
    Join Date
    Nov 2003
    Location
    Dublin, Ireland
    Posts
    16
    ;;
    Last edited by cryan2; 2003-11-25 at 15:45.

  11. #11
    Registered User
    Join Date
    Mar 2003
    Posts
    11
    Sorry, the only way I know to fix this compatibility problem
    is to modify the com.oreilly.servlet package source code.

    The problem is really in the 7250i phone.
    It appears to add extra space after "Content-Disposition: "
    in a non-standard way. For example:

    Content-Disposition: Form-Data;Name="upfile";Filename="Clip-art02.gif"

    Jaripekka

  12. #12
    Registered User
    Join Date
    Nov 2003
    Location
    Dublin, Ireland
    Posts
    16
    Hi Jarips,

    I have another question for you if you have time....

    I can successfully upload images&files using my html browser on my pc.


    However when I use an emulater I get the following error:

    _________________________
    java.io.IOException: Content disposition corrupt: Content-Disposition:form-data;name=&quot;upfile&quot;;filename=&quot;test.txt&quot;|content-disposition:form-data;name=&quot;upfile&quot;;filename=&quot;test.txt&quot;|-1|29
    at cryan2.com.oreilly.servlet.multipart.MultipartParser.extractDispositionInfo(MultipartParser.java:377)
    at cryan2.com.oreilly.servlet.multipart.MultipartParser.readNextPart(MultipartParser.java:300)
    at cryan2.com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:246)
    at cryan2.com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:109)
    at cryan2.Uploaderxhtml.doPost(Uploaderxhtml.java:22)


    ________________________________

    when I test this on my phone I get "Internal error in gateway".

    Do you know why this error has occured? Do you have a url that I could try to upload to, to check if my phone can actually upload?

    Thank you for your help,

    Regards,

    Conor :-)
    Last edited by cryan2; 2004-01-19 at 14:57.

  13. #13
    Registered User
    Join Date
    Mar 2003
    Posts
    11
    If you have access to cos source code, look again
    at MultipartParser.java in package com.oreilly.servlet.multipart
    and try something like this.

    // added trim
    String disposition = line.substring(start + 21, end).trim();

    if (!disposition.equals("form-data")) {
    // this exception was thrown before the fix
    throw new IOException("Invalid content disposition: [" + disposition +
    "]");
    }

    You can try my upload test site at
    https://medios.fi/up/i.nvl
    It does work with Nokia 7250i phone.

    Jaripekka

  14. #14
    Registered User
    Join Date
    Nov 2003
    Location
    Dublin, Ireland
    Posts
    16
    Hi Jarips,

    Thank you for that URL.
    I got the same error on my phone using your url: "Internal error in gateway".

    I have a feeling my mobile provider (O2) have restricted multi-part uploads in some way? Have you seen this before?

    Thanks again for your help,

    Conor

Posting Permissions

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