开发者

HttpPostedFileBase.SaveAs method question

开发者 https://www.devze.com 2022-12-20 10:38 出处:网络
I\'ve got an asp.net mvc application that uploads a file and stores them in one of the directories where the websit开发者_开发技巧e is located.

I've got an asp.net mvc application that uploads a file and stores them in one of the directories where the websit开发者_开发技巧e is located.

My question is... When you execute HttpPostedFileBase.SaveAs() method saving it with the same name as an existing filename on the folder, does HttpPostedfileBase overwrite the file?

Thanks a million!


Yes. Any existing file will be overwritten. (I checked the source)


HttpPostedFileBase is just an abstract base class - what SaveAs does depends on the implementation. However, it's clearly meant to abstract HttpPostedFile, and that will overwrite any files at the target location - if it can (i.e. has the appropriate permissions).

0

精彩评论

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