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).
精彩评论