473,799 Members | 3,072 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding a timestamp to a filename

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 filenameYYMMDDh hmmss.txt or something similar.
Can anyone advise how to do this?
Jul 19 '05 #1
2 8281
> 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 filenameYYMMDDh hmmss.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
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***@discussi ons.microsoft.c om> wrote in message
news:9D******** *************** ***********@mic rosoft.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 filenameYYMMDDh hmmss.txt or something similar.
Can anyone advise how to do this?

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
4703
by: Stegga | last post by:
Hi there, I'm trying to add 1 second incrementally to a timestamp while looping through it and I am pulling my hair out. Please can someone help me? example of code: $calc_timestamp = date('YmdHis',mktime(date('H'),date('i'),date('s')-50,date('m'),date('d'),date('Y')));
1
3783
by: Jimbo | last post by:
Hello, I'm not a perl programmer but I can kind of hack my way through some simple scripts. What I am trying to do is get it so a line break <br> is automatically placed when I hit the return key in a text box in this script: http://mosaikum.org/sonst/pws.html It will add the <br> automatically to the Add Story function, but not the edit text function. I'm trying to get it to do it in the edit
2
2889
by: Craig Keightley | last post by:
How do i display a date as a new column 7 days after the initial timestamp eg current timestamp = 20050310000000 if i add 7 days to this won't it result in 20050317000000 eg SELECT *, DATE_FORMAT('%d/%m/%Y' , (dateAuthorised+7)) as expiryDate I know this is the wrong approach as the timestamp 20050330000000 would cause an error
0
1082
by: Michael Probst | last post by:
Hi all, I am new to .NET and the way XML data is handled in .NET I wrote a small application with .NET forms in C++ The application reads data from an XML file to fill-in the fields of the form. This works fine but when I try to add new data to the XML file it does not comply with the XML schema file I am using.
2
5814
by: jay | last post by:
hi, Question on Load/import command. consider a sample table create table table_name ( col1 timestamp not null default current timestamp, col2 int, col3 int, col4 int, primary key(col1) ); There is a file file.del containing data for col2,col3,col4. Data for
0
1033
by: Sarah | last post by:
hi, i'm saving an excel workbook by the following: xlworkbook.SaveAs("mybook.xls",Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing); and it saves it as mybook.xls .......how can i add a timestamp to the filename?
7
6117
by: JJ | last post by:
How do I set one field to have the updated timestamp, and another to have the created timestamp? I want to do this directly from code generated from DB Designer if possible?! JJ
0
1424
by: AndyL69 | last post by:
Hello I've got a very strange Problem. When im adding a new ACE entry to a UNC Direcotry the inherented ACL's will be lost. When I'm adding a new ACE to a directory / file in this UNC path the inherented ACE are still available. What's wrong ? I don't understand the difference between \\server\share and \\server\share\directory while adding a ACE AndyL Sample: \\myserver\myshare Inherited ACE: Administrators, Network Service
2
2340
by: Craig | last post by:
We are trying to create an inhouse ID card system. What we would like to do is to have a webcam feed displayed in a webpage and for a user to be able to click a button to save the currently displayed feed as a jpg (on the local pc which will be uploaded to the server). Currently we are using the webcams own image capture software outside of our web app but this is not proving to be a very successful solution. Does anyone have any...
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10484
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10228
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.