开发者

ASP.NET FileUpload

开发者 https://www.devze.com 2023-01-03 05:12 出处:网络
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 SaveA

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 d开发者_StackOverflow中文版ate 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消