Gagri Global IT services is having a team of executives who have good experience in developing applications on various platforms like SharePoint 2013/2010, Silverlight, net Framework 4.5 and Mobile tools.

Time stamping

Posted on December 14, 2023 by Amruthavalli

Time stamping while uploading images:

  1. Positives of Time stamping
  2. Negatives of Time stamping

1. Positives of Time stamping :

    • Ensuring Uniqueness: One of the primary advantages of using timestamps is that it guarantees the uniqueness of each file name. By appending the current time to the original name, you create a distinct identifier for each file, minimizing the risk of overwriting existing content.
    • Easy Retrieval:Timestamps can aid in organizing and retrieving files. Users, administrators, or automated systems can easily identify and differentiate between multiple versions of a file by examining the timestamp in the file name.
    • Versioning:Timestamps can serve as a rudimentary form of versioning. Users can upload files with the same name, and by tracking the timestamps, it becomes possible to discern the chronological order of the uploads.
    • Preventing Data Loss: Using timestamps reduces the likelihood of unintentional data loss. Without timestamps, overwriting a file with a new version could lead to the permanent loss of the original content. Timestamps allow for the preservation of historical data.

2. Negatives of Time stamping :

    • File Proliferation: One drawback of appending timestamps is the potential for file proliferation. Over time, especially in applications with frequent uploads, the storage can become cluttered with numerous versions of the same file, making it challenging to manage and organize.
    • User Confusion: While timestamps aid in file differentiation, they can also lead to user confusion. Users might struggle to identify the latest or most relevant version of a file, particularly if the timestamps are not presented in a user-friendly format.
    • Long File Names:The addition of timestamps can result in longer file names, potentially exceeding system limits. This can cause issues with certain file systems, applications, or when sharing files with others, as some platforms may have restrictions on file name length.
    • Complexity in Code:Managing timestamps requires additional code complexity. Developers need to handle the parsing and formatting of timestamps, leading to increased code maintenance and potential sources of errors.

[System.Web.Http.AcceptVerbs("GET", "POST")] [System.Web.Http.HttpPost] public string UploadEmergencyTypeImage()
var filepath = "";
if (System.Web.HttpContext.Current.Request.Files.AllKeys.Any())
var baseFolder = "Content\\PDFS\\";
string folderPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, baseFolder);
if (!Directory.Exists(folderPath))
var httpPostedFile = System.Web.HttpContext.Current.Request.Files["PostedFile"];
if (httpPostedFile != null)
var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(httpPostedFile.FileName);
var fileExtension = Path.GetExtension(httpPostedFile.FileName);
var dateTimeNow = DateTime.Now.ToString("yyyy-MM-dd-HH-mm");
var fileNameWithDateTime = $"{fileNameWithoutExtension}{dateTimeNow}{fileExtension}";
var fileSavePath = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/Content/PDFS/"), fileNameWithDateTime);
filepath = "/Content/PDFS/" + fileNameWithDateTime;
return filepath;
catch (Exception ex)
return "";


All design and content Copyright © 2012-2018 Gagri Global IT Services Pvt.Ltd. All rights reserved