1
Reply

Getting exception on website at the time of uploading image

Ask a question
Hello
I have developed a webpage where i need to upload a image of user . I wrote code for that and tested it on local server. But when i uploaded it on server it giving exception
System.UnauthorizedAccessException: Access to the path 'C:\Inetpub\vhosts\pspl-it.com\site1\projects\SBI - Copy.jpg' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at ....
And my code is
string filename =System.IO.Path.GetFileName(Fileimage.PostedFile.FileName);
Fileimage.SaveAs(Server.MapPath("projects/") + filename);
Please suggest me.
Thanx in advance.

Answers (1)