Tuesday, December 2, 2008

Cannot create file when it already exists

hey friends,
when i was workin on my DotNetNuke project's module, which has functionality to upload a photo, i was getting a strange error like following:

Cannot create file when its already exists.
Message Cannot create a file when that file already exists.
Source mscorlib
TargetSite Void WinIOError(Int32, System.String)
StackTrace at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.__Error.WinIOError() at System.IO.FileInfo.MoveTo(String destFileName) at your function

This is strange, i looked at my code and it was almost perfect. so I was not able to find the any error.

After some debugging, i was able to find the error, and you will be surprised to know that it was coming when someone uploads a read only file.

:) i hope this will help you in case you are getting the same kinda error

No comments:

Post a Comment

Please add your valuable comments about this post if it helped you. Thanks