Using the oreilly package, you would do the following on the form submit page:

String filepath = "foodir";
com.oreilly.servlet.MultipartRequest multi = new 
com.oreilly.servlet.MultipartRequest(request, filepath, 5000000);

Enumeration files = multi.getFileNames();
while (files.hasMoreElements()) {
  String name = (String)files.nextElement();
  String filename = multi.getFilesystemName(name);
  if(filename != null){
  String content_type = multi.getContentType(name);
  File f = multi.getFile(name);
  // now you have the actual file, so you can get some some more info out of that
  // and put in a database or something to keep track of it.
}

Simple as that.  the files will be saved to filepath.

Travis


---- Original Message ----
From: "Wong, Connie" <[EMAIL PROTECTED]>
Sent: 2001-04-20 11:05:04.0
To: [EMAIL PROTECTED]
Subject: RE: RE: file upload servlet

Hi Travis,

I'm interest to know how to do it. Would you please post a sample?

Thanks,
Connie

> -----Original Message-----
> From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, April 20, 2001 11:47 AM
> To:   [EMAIL PROTECTED]
> Subject:      RE: RE: file upload servlet
> 
> Use input type="file" for file uploads.  Then to process them, you can use
> the oreilly servlets package at www.servlets.com.  If you need a sample
> let me know.
> 
> Travis
> 
> ---- Original Message ----
> From: Jim Alemany <[EMAIL PROTECTED]>
> Sent: 2001-04-20 09:31:55.0
> To: [EMAIL PROTECTED]
> Subject: RE: file upload servlet
> 
> jspsmart upload. Its a bean. works nicely.
> 
> Found at www.jspsmart.com (its a free bean too).
> 
> -----Original Message-----
> From: Christoph Kukulies [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 20, 2001 11:18 AM
> To: [EMAIL PROTECTED]
> Subject: file upload servlet
> 
> 
> 
> Is there an example somewhere for a servlet that allows for uploading
> and processing a file.
> 
> Scenario: client (browser side) has edited a file with some information
> or some kind of excel or Word document and need to get that processed.
> 
> The idea is to simply drag and drop the document into the broswer window
> and upload it to the server fopr processing.
> If that's too complicated (e.g. requiring swing or something)
> it would be sufficient if the client could be advised to
> open some kind of file selector or browser to select the file to be
> uploaded
> and send it upstream.
> 
> What requisites would be required for this?
> 
> 
> --
> Chris Christoph P. U. Kukulies [EMAIL PROTECTED]
> 

Reply via email to