First of all, by simply encapsulating the method body in a try-catch block and printing the exception in case of an error should usually let you pin-point the location of your error.
Secondly, after going through your code, as Orcun directed you, please read upon
Server.MapPath[
^] method. It allows you to map a path like "~/images/" to physical disk paths.
Additionally, my best guess is that this is a file permission issue. The account under which your web server is run as, might not have permissions on your machine to create files on some locations. Check on that.
Hope this helps