struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jayakumar ala <alajay...@gmail.com>
Subject Re: Unique Id creation
Date Thu, 17 Dec 2009 09:42:46 GMT
I am using Jquery MultiFile to select multiple file. I still be selecting
one by one file but when i do upload it will be multiple file. There are
other ways to select multiple files through Browse button like Flash
components or Applet.

On Tue, Dec 15, 2009 at 9:39 PM, Lee Clemens <java@leeclemens.net> wrote:

> OP: What Struts tag are you using to upload multiple files at the same
> time?
> I may be wrong, but I didn't know this was possible with Struts.   If so,
> what filename are they given by default? I use file upload tags but they
> are
> saved as default-named files I can access via the File setter in my Action
> (file.getAbsolutePath()).
>
> Otherwise, I would suggest going with a solution along the line of PK's
> solution with UUID (probably best with the ms timestamp) as part of the
> file
> name or using SecureRandom.nextInt and Integer.MAX_VALUE.
>
> To be extra safe, you could have a static Set to maintain all file names
> and
> ensure it not is contained in that Set before creating it (and populate the
> Set during initialization).
>
>
> TG, Out of curiosity, why would the current milliseconds past epoch need to
> be zero-padded? (besides code written for ~277 years from now, when it
> still
> likely wouldn't matter?)
>
> -----Original Message-----
> From: Todd Grigsby [mailto:strutsuser@tgrigsby.com]
> Sent: Tuesday, December 15, 2009 3:02 PM
> To: Struts Users Mailing List
> Subject: Re: Unique Id creation
>
> jayakumar ala wrote:
> > Hi All,
> >  I am using struts2 in my web application.
> >  Which is the best way to create unique Id for each file upload i do in
> my
> > application...?
> >
> > Thanks
> > Ala
> >
> >
>
> I've always used the original filename with a time stamp, down to the
> millisecond formatted with leading zeros and without separators,
> appended to the end.  If a create fails, I wait a few milliseconds and
> regenerate the filename.  The nice part about the time stamp is that you
> have the date and time the file was uploaded in the name itself.
>
> TG
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message