Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET FileUpload

Greetings!

I am using the ASP.NET FileUpload control to allow users to upload text files to our web server. Everything works great in terms of saving the file to where we wanted, etc, using the SaveAs() method of the control.

But we were caught off guard by one seemingly simple caveat: the original timestamp of the uploaded file was lost such as the date last modified and date create. The date last modified and date created become the actual date and time when the file is saved to the server.

My question is: is there anyway to retain the original timestamp by setting some attributes that I am not aware of yet or is it possible to read the metadata of the file to get its original time stamp?

Any in-sight and suggestions are greatly appreciated.

John

like image 734
John Avatar asked Oct 14 '22 04:10

John


1 Answers

Unless the file format being uploaded itself contains this data, then no.

When a file is uploaded to a web server, the binary data for the file is sent to the server, not the "file" as it is represented in the filesystem. You don't, for example, know that your file is coming from a compatible filesystem; you only get its data. Hence, the metadata is inaccessible.

like image 171
Martin Eve Avatar answered Oct 18 '22 03:10

Martin Eve