commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Cooper <mfncoo...@gmail.com>
Subject Re: Rename File While Upload
Date Mon, 01 Nov 2004 20:32:38 GMT
On Mon, 1 Nov 2004 15:28:52 -0500, Vito Campanelli
<vito.campanelli@mcgill.ca> wrote:
> Thanks Martin, but how can I get the extension? .doc, .pdf, .xls?

FileItem.getName() gives you the filename as it was supplied by the
browser. Assuming this has the extension on it, you can extract it
from that.

--
Martin Cooper


> Thanks
> 
> 
> 
> -----Original Message-----
> From: Martin Cooper [mailto:mfncooper@gmail.com]
> Sent: Monday, November 01, 2004 3:06 PM
> To: Jakarta Commons Users List
> Subject: Re: Rename File While Upload
> 
> On Mon, 1 Nov 2004 14:43:08 -0500, Vito Campanelli
> <vito.campanelli@mcgill.ca> wrote:
> > Hi Martin,
> >
> > Thanks for the reply.
> >
> > My user uploads a file filename.doc, once the file gets uploaded or
> > before, I would like to give it a more meaningful name
> > (firstname_lastname.doc).
> >
> > Is this possible? Right now I am using the following:
> >
> > Runtime r = Runtime.getRuntime();
> >            r.exec("cmd /c rename " ......)
> >
> > I just wonder is there something else I could use.
> 
> You have complete control over what the actual file name is, since you
> can pass whatever name you want to the write() method.
> 
> --
> Martin Cooper
> 
> > Thanks
> > Vito
> >
> >
> >
> >
> > -----Original Message-----
> > From: Martin Cooper [mailto:mfncooper@gmail.com]
> > Sent: Monday, November 01, 2004 2:08 PM
> > To: Jakarta Commons Users List
> > Subject: Re: Rename File While Upload
> >
> > On Mon, 1 Nov 2004 12:27:52 -0500, Vito Campanelli
> > <vito.campanelli@mcgill.ca> wrote:
> > > Hi,
> > >
> > > I am using the FileUpload 1.0 with success.
> > >
> > > My question is, is there anyway to rename the file before it gets
> > > uploaded?
> >
> > I'm not entirely sure I understand what you mean by this. It's not
> > possible to rename the file on the local disk before uploading. On the
> > other hand, it is entirely your choice as to whether or not to use the
> > file name supplied by the browser when the file is uploaded.
> >
> > Perhaps you could clarify what it is that you are trying to do?
> >
> > --
> > Martin Cooper
> >
> > > Thanks in advance.
> > >
> > > Vito
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> 
> 
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
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