Last post Aug 17, 2020 12:03 PM by PatriceSc
Aug 16, 2020 03:32 PM|wmec|LINK
is the path to which I've deployed the project.
File output000.jpg, does exist within this path and what is the reason of error below?
Could not find a part of the path '~/output000.jpg'.
Aug 16, 2020 04:39 PM|PatriceSc|LINK
Seems to happen with a file processing function? ~ is a special notation for the root of the web application which is never used "as is":
It allows to write code without having to know where your site will be installed but it needs to be converted to a physical path or an url before being used.
Aug 17, 2020 01:20 AM|wmec|LINK
How to resolve issue to ensure it would refer to file in path below?
Aug 17, 2020 04:42 AM|PaulTheSmith|LINK
Do you want us to fix your code? You will need to show your code!
Aug 17, 2020 06:35 AM|wmec|LINK
Here is the line
File.Copy("~/output000.jpg", "~/output.jpg", true);
leading to problem.
Aug 17, 2020 07:10 AM|PaulTheSmith|LINK
PatriceSc has guessed that this was your code and shown the correct way to get the filename.
Aug 17, 2020 12:03 PM|PatriceSc|LINK
So you try to copy a file found in a ~ folder. It should be for example :
File.Copy(Server.MapPath("~/output000.jpg"), Server.MapPath("~/output.jpg"), true);