You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Himmelfarb, Joy (Bond, Bond HO)" <Jo...@thehartford.com> on 2006/02/02 19:35:41 UTC

[FileUpload] content type header is null

I could use some help, please.

I am trying to upload a file on my local drive using IE.  I have an <input> of type=file, and other <input> tags as well.
My form tag is 	<form name=frm action=./MyPage.jsp method=post ENCTYPE="multipart/form-data" >  .

I have implemented the sample code within the jsp and (alternatively) in a java file.  The result is the same either way - 
"the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is null".

Any suggestions?
Thanks
Joy

_________________
Joy Himmelfarb  
Bond Automation
(860) 547-7099 



*************************************************************************
This communication, including attachments, is
for the exclusive use of addressee and may contain proprietary,
confidential and/or privileged information.  If you are not the intended
recipient, any use, copying, disclosure, dissemination or distribution is
strictly prohibited.  If you are not the intended recipient, please notify
the sender immediately by return e-mail, delete this communication and
destroy all copies.
*************************************************************************


Re: [FileUpload] content type header is null

Posted by benjamin haimerl <b-...@gmx.de>.
well im not sure about this ./Your.jsp but i dont think you have to use it 
in this way,
just putting in there your jsp should be fine, because of the same context 
path...
anyway im using it in this way:

<form action="UploadFile.jsp" method="POST"

enctype="multipart/form-data">

..

<input type="file" name="file" >



and the UploadFile.jsp

if(FileUpload.isMultipartContent(request)) {

DiskFileUpload upload = new DiskFileUpload();

List items = upload.parseRequest(request);


Iterator iter = items.iterator();

while (iter.hasNext()) {

FileItem item = (FileItem) iter.next();


dateiName=item.getName().toString();

if(dateiName.lastIndexOf("\\")>=0) {

dateiName = dateiName.substring(dateiName.lastIndexOf("\\")+1);

}


if (true) {

File uploadedFile = new File(uploadDir+"/"+dateiName);

item.write(uploadedFile);

} else {

InputStream uploadedStream = item.getInputStream();

uploadedStream.close();

}



maybe you have the same problem that i got, the internet explorer sends the 
full pathname in that request,

not only the filename like the firefox does,

so i have to correct the string



but in that case it works fine for me...

i hope it helps you out.



Benjamin Haimerl





----- Original Message ----- 
From: "Himmelfarb, Joy (Bond, Bond HO)" <Jo...@thehartford.com>
To: <co...@jakarta.apache.org>
Sent: Thursday, February 02, 2006 7:35 PM
Subject: [FileUpload] content type header is null


I could use some help, please.

I am trying to upload a file on my local drive using IE.  I have an <input> 
of type=file, and other <input> tags as well.
My form tag is <form name=frm action=./MyPage.jsp method=post 
ENCTYPE="multipart/form-data" >  .

I have implemented the sample code within the jsp and (alternatively) in a 
java file.  The result is the same either way -
"the request doesn't contain a multipart/form-data or multipart/mixed 
stream, content type header is null".

Any suggestions?
Thanks
Joy

_________________
Joy Himmelfarb
Bond Automation
(860) 547-7099



*************************************************************************
This communication, including attachments, is
for the exclusive use of addressee and may contain proprietary,
confidential and/or privileged information.  If you are not the intended
recipient, any use, copying, disclosure, dissemination or distribution is
strictly prohibited.  If you are not the intended recipient, please notify
the sender immediately by return e-mail, delete this communication and
destroy all copies.
*************************************************************************



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [FileUpload] content type header is null

Posted by benjamin haimerl <b-...@gmx.de>.
lol yeah right, but i already have no problems with the file upload,
Joy started this thread here ;)
I just want to help, by put in my code here ;)

i hope meanwhile he could solve his problem..


----- Original Message ----- 
From: "Niall Pemberton" <ni...@blueyonder.co.uk>
To: "Jakarta Commons Users List" <co...@jakarta.apache.org>
Sent: Friday, February 03, 2006 1:01 PM
Subject: Re: [FileUpload] content type header is null


> You're missing a quote on the method attribute.
>
> Niall
>
> ----- Original Message ----- 
> From: "benjamin haimerl" <b-...@gmx.de>
> Sent: Friday, February 03, 2006 6:26 AM
>
>
>> ok. here is an exact copy ;)
>> fileChooser.jsp
>>
>> <form action="fileUpload.jsp" method=post" enctype="multipart/form-data">
>> <input type="file" name="file">
>> <input type="submit" >
>> </form>
>>
>> ----- Original Message ----- 
>> From: "Niall Pemberton" <ni...@gmail.com>
>> Sent: Friday, February 03, 2006 1:20 AM
>>
>>
>> On 2/2/06, Himmelfarb, Joy (Bond, Bond HO)
>> <Jo...@thehartford.com> wrote:
>> > I could use some help, please.
>> >
>> > I am trying to upload a file on my local drive using IE.  I have an
>> > <input> of type=file, and other <input> tags as well.
>> > My form tag is  <form name=frm action=./MyPage.jsp method=post
>> > ENCTYPE="multipart/form-data" >  .
>> > I have implemented the sample code within the jsp and (alternatively) 
>> > in
> a
>> > java file.  The result is the same either way -
>> > "the request doesn't contain a multipart/form-data or multipart/mixed
>> > stream, content type header is null".
>>
>>
>> My guess is that your html isn't properly formed - is the above an
>> exact copy/paste of what you have? If so try putting quotes around
>> your attribute values - especially the "/MyPage.jsp" - since it
>> contains a "/". If this isn't copy/patsed from what you have then,
>> please show the actual code.
>>
>> Niall
>>
>> > Any suggestions?
>> > Thanks
>> > Joy
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [FileUpload] content type header is null

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
You're missing a quote on the method attribute.

Niall

----- Original Message ----- 
From: "benjamin haimerl" <b-...@gmx.de>
Sent: Friday, February 03, 2006 6:26 AM


> ok. here is an exact copy ;)
> fileChooser.jsp
>
> <form action="fileUpload.jsp" method=post" enctype="multipart/form-data">
> <input type="file" name="file">
> <input type="submit" >
> </form>
>
> ----- Original Message ----- 
> From: "Niall Pemberton" <ni...@gmail.com>
> Sent: Friday, February 03, 2006 1:20 AM
>
>
> On 2/2/06, Himmelfarb, Joy (Bond, Bond HO)
> <Jo...@thehartford.com> wrote:
> > I could use some help, please.
> >
> > I am trying to upload a file on my local drive using IE.  I have an
> > <input> of type=file, and other <input> tags as well.
> > My form tag is  <form name=frm action=./MyPage.jsp method=post
> > ENCTYPE="multipart/form-data" >  .
> > I have implemented the sample code within the jsp and (alternatively) in
a
> > java file.  The result is the same either way -
> > "the request doesn't contain a multipart/form-data or multipart/mixed
> > stream, content type header is null".
>
>
> My guess is that your html isn't properly formed - is the above an
> exact copy/paste of what you have? If so try putting quotes around
> your attribute values - especially the "/MyPage.jsp" - since it
> contains a "/". If this isn't copy/patsed from what you have then,
> please show the actual code.
>
> Niall
>
> > Any suggestions?
> > Thanks
> > Joy



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [FileUpload] content type header is null

Posted by benjamin haimerl <b-...@gmx.de>.
ok. here is an exact copy ;)
fileChooser.jsp

<form action="fileUpload.jsp" method=post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" >
</form>





----- Original Message ----- 
From: "Niall Pemberton" <ni...@gmail.com>
To: "Jakarta Commons Users List" <co...@jakarta.apache.org>
Sent: Friday, February 03, 2006 1:20 AM
Subject: Re: [FileUpload] content type header is null


On 2/2/06, Himmelfarb, Joy (Bond, Bond HO)
<Jo...@thehartford.com> wrote:
> I could use some help, please.
>
> I am trying to upload a file on my local drive using IE.  I have an 
> <input> of type=file, and other <input> tags as well.
> My form tag is  <form name=frm action=./MyPage.jsp method=post 
> ENCTYPE="multipart/form-data" >  .
> I have implemented the sample code within the jsp and (alternatively) in a 
> java file.  The result is the same either way -
> "the request doesn't contain a multipart/form-data or multipart/mixed 
> stream, content type header is null".


My guess is that your html isn't properly formed - is the above an
exact copy/paste of what you have? If so try putting quotes around
your attribute values - especially the "/MyPage.jsp" - since it
contains a "/". If this isn't copy/patsed from what you have then,
please show the actual code.

Niall

> Any suggestions?
> Thanks
> Joy

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [FileUpload] content type header is null

Posted by Niall Pemberton <ni...@gmail.com>.
On 2/2/06, Himmelfarb, Joy (Bond, Bond HO)
<Jo...@thehartford.com> wrote:
> I could use some help, please.
>
> I am trying to upload a file on my local drive using IE.  I have an <input> of type=file, and other <input> tags as well.
> My form tag is  <form name=frm action=./MyPage.jsp method=post ENCTYPE="multipart/form-data" >  .
> I have implemented the sample code within the jsp and (alternatively) in a java file.  The result is the same either way -
> "the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is null".


My guess is that your html isn't properly formed - is the above an
exact copy/paste of what you have? If so try putting quotes around
your attribute values - especially the "/MyPage.jsp" - since it
contains a "/". If this isn't copy/patsed from what you have then,
please show the actual code.

Niall

> Any suggestions?
> Thanks
> Joy

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org