Append datetime to filename before file ext.

Jun 1, 2009 at 9:17 AM
Edited Jun 2, 2009 at 6:39 AM

Please le me know how to append datetime to filename before file extension. eg: If the file being uploaded is "abc.jpg", then it should be uploaded as "abc-010620091134750.jpg" i.e. filename-ddmmyyyyhh24miss.extension.

Modified the FileUpload.ashx.cs http handler as:

 

 

<font size="2" color="#0000ff">

void

</font>

 fileUpload_FileUploadCompleted(object sender, FileUploadCompletedEventArgs args)

{

<font size="2">

args.FileName = args.FileName + System.

</font>

DateTime.Now();  // ADDED THIS.<font size="2">

 

</font>

 

string id = ctx.Request.QueryString["id"];

}

But no use.