Multiple files upload
Hi, We need to upload all the files in a directory from the clients machine to the server. I've been reading that we could achieve that using the Oreilly's MultipartRequest object. But I understood that you can do that file by file only but not all the files if the client selects a directory. If anyone has experience in uploading multiple files through a servlet, I would appreciate if you could guide me in the right direction. I was also considering using FTPClient class in sun.net package. But couldn't find any documentation for that. Is it advisable to use that? any thoughts on FTP from a servlet?? Thanks for your help, Lakshmi
RE: Multiple files upload
Lakshmi If you are using an HTML form to upload the file then you have some restrictions. The file input element lets you upload one file only and you cannot script this element (i.e. you cannot dynamically set the value of the field for security reasons.) This led us to writing an applet but we couldn't find any easy way of building a multipart message using the standard java.net package. In the end we use the java zip capabilities to zip all the required files into a single file and then sent it using the HTTPClient available at http://www.innovation.ch/java/HTTPClient/. We could have uploaded the file to a servlet using the HTTP PUT method but we were sending to a CGI script that only supported POST and GET so we had to use the multipart message. In you case a combination of zip and PUT might work. Pete -Original Message- From: Adilakshmi Lingam [mailto:[EMAIL PROTECTED]] Sent: 28 March 2001 21:39 To: Tomcat-User@Jakarta. Apache. Org Subject: Multiple files upload Hi, We need to upload all the files in a directory from the clients machine to the server. I've been reading that we could achieve that using the Oreilly's MultipartRequest object. But I understood that you can do that file by file only but not all the files if the client selects a directory. If anyone has experience in uploading multiple files through a servlet, I would appreciate if you could guide me in the right direction. I was also considering using FTPClient class in sun.net package. But couldn't find any documentation for that. Is it advisable to use that? any thoughts on FTP from a servlet?? Thanks for your help, Lakshmi
RE: Multiple files upload
I use the input type along with a hacked about version of the O'Reilly class to let me set FileFilters to control the file types people want to upload and it works fine for multiple files -Original Message- From: Edwards, Peter [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 29, 2001 9:31 AM To: '[EMAIL PROTECTED]' Subject: RE: Multiple files upload Lakshmi If you are using an HTML form to upload the file then you have some restrictions. The file input element lets you upload one file only and you cannot script this element (i.e. you cannot dynamically set the value of the field for security reasons.) This led us to writing an applet but we couldn't find any easy way of building a multipart message using the standard java.net package. In the end we use the java zip capabilities to zip all the required files into a single file and then sent it using the HTTPClient available at http://www.innovation.ch/java/HTTPClient/. We could have uploaded the file to a servlet using the HTTP PUT method but we were sending to a CGI script that only supported POST and GET so we had to use the multipart message. In you case a combination of zip and PUT might work. Pete -Original Message- From: Adilakshmi Lingam [mailto:[EMAIL PROTECTED]] Sent: 28 March 2001 21:39 To: Tomcat-User@Jakarta. Apache. Org Subject: Multiple files upload Hi, We need to upload all the files in a directory from the clients machine to the server. I've been reading that we could achieve that using the Oreilly's MultipartRequest object. But I understood that you can do that file by file only but not all the files if the client selects a directory. If anyone has experience in uploading multiple files through a servlet, I would appreciate if you could guide me in the right direction. I was also considering using FTPClient class in sun.net package. But couldn't find any documentation for that. Is it advisable to use that? any thoughts on FTP from a servlet?? Thanks for your help, Lakshmi
AW: Multiple files upload
There are two sides of your problem: the server and the client. If you use FTPClient in the servlet you need a FTP server on the client (Which is not a very common situation). If your client doesn't have a FTP server the only option to use FTP is the other way round: Build an applet that is an FTP client that write to a FTP server on the server. The second option is to write an applet that posts the files in the directory to a servlet so you can use the MultiPartRequest in the servlet. > -Ursprüngliche Nachricht- > Von: Adilakshmi Lingam [mailto:[EMAIL PROTECTED]] > Gesendet: Mittwoch, 28. März 2001 22:39 > An: Tomcat-User@Jakarta. Apache. Org > Betreff: Multiple files upload > > > Hi, > > We need to upload all the files in a directory from the > clients machine to > the server. > I've been reading that we could achieve that using the Oreilly's > MultipartRequest object. But I understood that you can do > that file by file > only but not all the files if the client selects a directory. > > If anyone has experience in uploading multiple files through > a servlet, I > would appreciate if you could guide me in the right direction. > > I was also considering using FTPClient class in sun.net package. But > couldn't find any documentation for that. Is it advisable to > use that? any > thoughts on FTP from a servlet?? > > Thanks for your help, > Lakshmi > >