-
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
-
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.
-
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
-
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.
-
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
-
Yeah php was the problem. I made a test page with cgi-perl and it worked fine.
-
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 :-)
-
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
-
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 :-)
-
-
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
-
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="upfile";filename="test.txt"|content-disposition:form-data;name="upfile";filename="test.txt"|-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 :-)
-
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
[url]https://medios.fi/up/i.nvl[/url]
It does work with Nokia 7250i phone.
Jaripekka
-
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