Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6863989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:51:20+00:00 2026-05-27T02:51:20+00:00

I upload an XML file to migrate its contents to my database, but I

  • 0

I upload an XML file to migrate its contents to my database, but I want firstly store the last modified date of that file to assure that no change has happened to that file from the last one.

How do I get the last modified date of the file ?

Is there any javascript function to do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:51:20+00:00Added an answer on May 27, 2026 at 2:51 am

    This information is never sent to the server when you use a file input to upload a file. Only the filename, mime type and contents are sent with multipart/form-data. You could use the HTML5 File API to obtain this information from the file before uploading it.


    As requested in the comments section here’s an example of an ASP.NET page which has an upload control and a hidden field which will be used to store and send the file last modified date to the server using the HTML5 File API:

    <%@ Page Language="C#" %>
    <%@ Import Namespace="System.Globalization" %>
    
    <script type="text/C#" runat="server">
        protected void BtnUploadClick(object sender, EventArgs e)
        {
            var file = Request.Files[0];
            DateTime date;
            if (DateTime.TryParseExact(lastModifiedDate.Value, "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out date))
            {
                // you could use the date here
            }
        }
    </script>
    
    <!DOCTYPE html>
    <html>
    <head>
        <title></title>
    </head>
    <body>
        <form id="Form1" runat="server">
            <label for="up">Pick a file</label>
            <asp:FileUpload ID="up" runat="server" />
            <asp:HiddenField ID="lastModifiedDate" runat="server" />
            <asp:LinkButton ID="btnUpload" runat="server" Text="Upload" OnClick="BtnUploadClick" />
        </form>
    
        <script type="text/javascript">
            if (!window.File) {
                alert('Sorry, your browser doesn\'t support the File API so last modified date will not be available');
            } else {
                document.getElementById('<%= up.ClientID %>').onchange = function () {
                    if (this.files.length > 0) {
                        if (typeof this.files[0].lastModifiedDate === 'undefined') {
                            alert('Sorry, your browser doesn\'t support the lastModifiedDate property so last modified date will not be available');
                        } else {
                            var lmDate = this.files[0].lastModifiedDate;
                            var hidden = document.getElementById('<%= lastModifiedDate.ClientID %>');
                            hidden.value = lmDate.getFullYear() + '-' + (lmDate.getMonth() + 1) + '-' + lmDate.getDate();
                        }
                    }
                };
            }
        </script>
    </body>
    </html>
    

    So in this example we subscribe for the onchange event of the file input and if the client browser supports HTML5 File API we can obtain information about the selected file such as its name, size, last modified date, … In this example we store the last modified date into a hidden field so that this information is available on the server once we upload the file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Q: I allow my user to upload an xml file to insert its contents
I want to read a client side XML file uploaded via upload file dialog.
I have xml file with collection image urls and I want upload this url
I am looking for the best way to upload the XML file to the
Is there any other place besides the metabase.xml file where the file upload size
I try this command to upload a file (standard.xml) into table book the file
I'm writing a servlet that receives an xml file from the client and works
I have a C# ASP.NET web page with an xml file upload form. When
I'm attempting to upload an xml file to my site. However, regardless of which
I'm trying to upload an xml file to Artifactory using their Deploy api call.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.