On Fri, 23 Jul 2004 11:14:58 -0700, Thomas Joseph Olaes <[EMAIL PROTECTED]> wrote: > Craig, > > Thank you for your reply, this has cleared things up somewhat for me. > > List, > > I wonder if there are any sites out there that I haven't come across yet > that will give me a few hints on how to get a text file upload working > on a JSP script. I'm only 3 days into working with JSPs, but I have > experience with ColdFusion and PHP which apparently tend to do a lot of > stuff for you behind the scenes, including file upload.
Another way of saying what Craig said is "don't do that". ;-) You should not be trying to handle multipart uploads from a JSP page with *any* package that you come across - you should be using a servlet for that instead. Otherwise you're likely to land yourself in trouble. All you need is a little servlet that wraps up FileUpload, and you'll be all set. -- Martin Cooper > > Thanks in advance for any help > -TJ > > > > > -----Original Message----- > > From: Craig McClanahan [mailto:[EMAIL PROTECTED] > > Sent: Friday, July 23, 2004 11:03 AM > > To: Jakarta Commons Users List > > Subject: Re: [FileUpload] Question re Sample Code for MultipartStream > > class (what is OutputStream output for?) > > > > On Fri, 23 Jul 2004 10:51:47 -0700, Thomas Joseph Olaes > > <[EMAIL PROTECTED]> wrote: > > > Hello List, > > > > > > This is my first email post to the group. > > > > > > My question regarding the example code listed at the top of the > > > MultipartStream class javadoc page: What is OutputStream output for? > Is > > > it for the "out" variable? I'm getting an error with my current code > > > saying I have to initialize it... how do I do this? I was reading > > > through the javadoc and supposedly readBodyData(OutputStream) is > > > supposed to give the outputstream a value, but is there some kind of > > > initialization I have to do before hand? Like point the OutputStream > > > towards the "out" variable somehow? > > > > Thomas, > > > > One thing to keep in mind is that the sample code you are looking at > > is designed to be run inside a servlet, not a JSP page. I suspect > > that, given what a JSP page does to the incoming request, this is > > never going to work. I would also suggest that you look at the > > example on the "Package Documentation" page of the > > org.apache.commons.fileupload Javadocs ... it shows how to use the > > higher level APIs (DiskFileUpload) instead of the low level one you > > are using. > > > > With regards to your question, The "output" variable (of type > > OutputStream) should be initialized to wherever you want to write the > > content of the body part in question. > > > > Craig > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
