asp.net - Could not find a part of the path 'C:\Users\shyful\Desktop\MvcApp\MvcApp\Person\Upload\Jellyfish.jpg' -
when ran project ,it shows "could not find part of path 'c:\users\shyful\desktop\mvcapp\mvcapp\person\upload\jellyfish.jpg'.
description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code.
exception details: system.io.directorynotfoundexception: not find part of path 'c:\users\shyful\desktop\mvcapp\mvcapp\person\upload\jellyfish.jpg'.
uploadfile.saveas(filepatha); db.image.add(image); db.entry(image).state = entitystate.modified;
where's wrong in code
the exception message: "could not find part of path ..." message of directorynotfoundexception
.
in order save file have ensure directory exists first!
run before save file:
if(!directory.exists(@"c:\users\shyful\desktop\mvcapp\mvcapp\person\upload\")) { directory.createdirectory(@"c:\users\shyful\desktop\mvcapp\mvcapp\person\upload\"); }
Comments
Post a Comment