File upload date and Time

Discussion in 'ASP .Net Web Controls' started by Chris Strobel, Feb 4, 2004.

  1. Is there a way using the Input Type=File and ASP.NET to keep the original
    date and time stamp of files I'm uploading? If not, what about getting the
    original date and time stamps and changing them after the file is uploaded
    to the server?

    Thanks,
    Chris
     
    Chris Strobel, Feb 4, 2004
    #1
    1. Advertising

  2. Hi Chris,
    You can use File.GetLastWriteTime to get the date and time the
    specified file or directory was last written to.
    In C# for eg:
    string file_path=@"c:\test\yourfile.txt";
    DateTime dt=File.GetLastWriteTime(file_path);

    In VB.NET
    Dim file_path As String = "c:\test\yourfile.txt"

    Dim dt As DateTime = File.GetLastWriteTime(file_path)

    If you want to set the last write time to
    some date and time you want :
    For Eg:
    In C#
    File.SetLastWriteTime(file_path, DateTime.Now);
    In VB.NET
    File.SetLastWriteTime(file_path, DateTime.Now)
    This will update the last write time to the current
    time.

    Hope this helps.
    Regards,
    Marshal Antony
    ..NET Developer
    http://www.dotnetmarshal.com









    "Chris Strobel" <> wrote in message
    news:...
    > Is there a way using the Input Type=File and ASP.NET to keep the original
    > date and time stamp of files I'm uploading? If not, what about getting the
    > original date and time stamps and changing them after the file is uploaded
    > to the server?
    >
    > Thanks,
    > Chris
    >
    >
     
    Marshal Antony, Feb 7, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2FyYXY=?=

    Upload a file without file Upload control - ASP.Net

    =?Utf-8?B?U2FyYXY=?=, Aug 2, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    2,492
    Bruce Barker
    Aug 3, 2005
  2. Chris Berg
    Replies:
    0
    Views:
    806
    Chris Berg
    Oct 27, 2003
  3. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,295
    Michael Borgwardt
    May 30, 2004
  4. Keith Cochrane
    Replies:
    2
    Views:
    629
    Keith Cochrane
    Aug 6, 2006
  5. Summu82
    Replies:
    5
    Views:
    876
    Richard Heathfield
    Jun 7, 2006
Loading...

Share This Page