I have problem in Visual Studio 2005 C# that I cannot resolve.
I have a path to my folder _putanja = @"images"; and I want
to save one file in my case image file let say image_name.jpg in this folder.
Now in new string I try to concatenate path with file (file will be in this folder) but when I try to concatenate like:
_fotka = textBox8.Text.Trim(); //this is where I enter name of picture
_slika = _putanja + @"\" + _fotka + ".jpg";
when I debug I get \\ instead of \ backslash
result is “slike\\image_name.jpg”, bit I want “slike\image_name.jpg” with just one backslash, because I will write this in DB and when I will read this string with 2 \\ I will get error!
Any help, what is wrong with my code.
In the above code, if _putanja contains a proper path, then <picture_name>.jpg will be appended to it.
On caveat to the above code is that it doesn't detect if a user enters the .jpg extension into the textbox. The code as written will happily append a second ".jpg" to the picture name even if one already exists. If this is a concern to you, then modify the code to ensure only one .jpg extension ever gets added.