Just use
string imgname = UpImage.FileName;
Instead of
string imgname = UpImage.PostedFile.FileName;
and Give a Try.
[Edited for clarification of my answer]
UpImage.FileName returns just file name e.g. xyz.gif
and UpImage.PostedFile.FileName returns full path e.g. d:\abc\xyz.gif
so the concationation (string path = "~/images/"+ imgname) will be unknown location, thats why he is facing error.