Re: Servlet 3.0 File Upload

2011-09-06 Thread Ole Ersoy
Thanks guys! Ole On 09/03/2011 10:51 AM, Konstantin Preißer wrote: Hi, -Original Message- From: Jonathan Soons [mailto:jso...@juilliard.edu] Sent: Saturday, September 03, 2011 2:24 PM To: Ole Ersoy; Tomcat Users List Subject: RE: Servlet 3.0 File Upload You need to add a line

Re: Servlet 3.0 File Upload

2011-09-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Konstantin, On 9/3/2011 11:51 AM, Konstantin Preißer wrote: What I usually do to get the filename is: Part uploadPart = request.getPart(uploadfield); // get the Part String contDispoHeader = uploadPart.getHeader(Content-Disposition); // get

Re: Servlet 3.0 File Upload

2011-09-06 Thread verlag.preis...@t-online.de
Hi Chris, It seems dangerous to allow the client to specify the file name. All kinds of bad things can happen such as specifying special file names (does PRN still work in win32? through Java?) or overwriting files from other clients. I would highly recommend that some portion of the

Re: Servlet 3.0 File Upload

2011-09-05 Thread André Warnier
: Ole Ersoy [ole.er...@gmail.com] Sent: Friday, September 02, 2011 6:50 PM To: Tomcat Users List Subject: Servlet 3.0 File Upload Hi, I have a working file upload servlet, with the exception that it calls the uploaded file samplefile instead of using the name of the file. So if I upload different

Re: Servlet 3.0 File Upload

2011-09-05 Thread Ole Ersoy
= req.getParameter(filename); Then instead of part.write(samplefile); do: part.write(filename); Jonathan Soons From: Ole Ersoy [ole.er...@gmail.com] Sent: Friday, September 02, 2011 6:50 PM To: Tomcat Users List Subject: Servlet 3.0 File Upload Hi, I have a working file

Re: Servlet 3.0 File Upload

2011-09-05 Thread Ole Ersoy
= req.getParameter(filename); Then instead of part.write(samplefile); do: part.write(filename); Jonathan Soons From: Ole Ersoy [ole.er...@gmail.com] Sent: Friday, September 02, 2011 6:50 PM To: Tomcat Users List Subject: Servlet 3.0 File Upload Hi, I have a working file

RE: Servlet 3.0 File Upload

2011-09-03 Thread Jonathan Soons
From: Ole Ersoy [ole.er...@gmail.com] Sent: Friday, September 02, 2011 6:50 PM To: Tomcat Users List Subject: Servlet 3.0 File Upload Hi, I have a working file upload servlet, with the exception that it calls the uploaded file samplefile instead of using the name

RE: Servlet 3.0 File Upload

2011-09-03 Thread Konstantin Preißer
Hi, -Original Message- From: Jonathan Soons [mailto:jso...@juilliard.edu] Sent: Saturday, September 03, 2011 2:24 PM To: Ole Ersoy; Tomcat Users List Subject: RE: Servlet 3.0 File Upload You need to add a line in in your form: input type=text name=filename / Then in your

Re: Servlet 3.0 File Upload

2011-09-03 Thread chris derham
You need to add a line in in your form: input type=text name=filename / Then in your servlet GetPost() method you put this filename in a variable: String filename; filename = req.getParameter(filename); Then instead of part.write(samplefile); do: part.write(filename);

RE: Servlet 3.0 File Upload

2011-09-03 Thread Konstantin Preißer
Hi, -Original Message- From: cjder...@gmail.com [mailto:cjder...@gmail.com] On Behalf Of chris derham Sent: Saturday, September 03, 2011 6:51 PM To: Tomcat Users List Subject: Re: Servlet 3.0 File Upload Letting the remote user control the name of the file that is written

Servlet 3.0 File Upload

2011-09-02 Thread Ole Ersoy
Hi, I have a working file upload servlet, with the exception that it calls the uploaded file samplefile instead of using the name of the file. So if I upload different files, they all overwrite each other. Any ideas on how to fix this? I used this tutorial to get it working:

Re: Servlet 3.0 File Upload

2011-09-02 Thread Ole Ersoy
Never mind...I see the example hard codes the name of the file. Sorry for the noise. On 09/02/2011 05:50 PM, Ole Ersoy wrote: Hi, I have a working file upload servlet, with the exception that it calls the uploaded file samplefile instead of using the name of the file. So if I upload