commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "benjamin haimerl" <b-ski...@gmx.de>
Subject Re: [FileUpload] content type header is null
Date Thu, 02 Feb 2006 20:14:02 GMT
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)" <Joy.Himmelfarb@thehartford.com>
To: <commons-user@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


Mime
View raw message