By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,880 Members | 2,279 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,880 IT Pros & Developers. It's quick & easy.

Adding a timestamp to a filename

P: n/a
I am uploading files to my webserver using an asp upload script and would
like to add a timestamp just before they are saved to the server.
This would mean that filename.txt on my server would be uploaded to the
webserver as filenameYYMMDDhhmmss.txt or something similar.
Can anyone advise how to do this?
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
> I am uploading files to my webserver using an asp upload script and would
like to add a timestamp just before they are saved to the server.
This would mean that filename.txt on my server would be uploaded to the
webserver as filenameYYMMDDhhmmss.txt or something similar.
Can anyone advise how to do this?


Most likely, depends on what upload component you are using. Several have a
SaveAs method or something equivalent.

--
http://www.aspfaq.com/
(Reverse address to reply.)
Jul 19 '05 #2

P: n/a
Hello,

If your file name 100% has file extension:

Get file extension:
Response.Write UBound (Split (LCase ("filename.com.txt"), ".", -1, 1))

Get date/time stamp:
N = Now
Response.Write Right ("0" & Year (N), 4) & Right ("0" & Month (N), 2) &
Right ("0" & Day (N), 2) & "_" & Right ("0" & Hour (N), 2) & Right ("0" &
Minute (N), 2) & Right ("0" & Second(Now), 2)

Or, simple rename file later, after upload. Do upload in some temporarely
folder (by date/time), then rename file.

With best regards,

--

Should you have any questions, please don't hesitate to contact me.
If you response to an email, please quote the complete message.
http://1click.lv

"kbrad" <kb***@discussions.microsoft.com> wrote in message
news:9D**********************************@microsof t.com...
I am uploading files to my webserver using an asp upload script and would
like to add a timestamp just before they are saved to the server.
This would mean that filename.txt on my server would be uploaded to the
webserver as filenameYYMMDDhhmmss.txt or something similar.
Can anyone advise how to do this?

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.