struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriel Belingueres <belingue...@gmail.com>
Subject Re: Unique Id creation
Date Tue, 15 Dec 2009 20:54:26 GMT
I use File.createTempFile:

http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#createTempFile(java.lang.String,%20java.lang.String,%20java.io.File)

Then I relate the uploaded filename with the saved temp file name in a
database table.

Gabriel

2009/12/15 Todd Grigsby <strutsuser@tgrigsby.com>:
> 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
View raw message