Possible Duplicate:
How to avoid System.IO.PathTooLongException?
In my application folder structure has a very long time. I need the files saved in this folder (I have no option to change the schema folder!)
[Edited]
using (var fileStream = File.Create(@"\\?\" + filePath, (int) file.Value.Length))
{
var bytesInStream = new byte[file.Value.Length];
file.Value.Read(bytesInStream, 0, bytesInStream.Length);
fileStream.Write(bytesInStream, 0, bytesInStream.Length);
}
The problem is that the full path "filePath" has more than 260 characters!
Error:
System.IO.PathTooLongException The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
But he must be saved in this folder!
How, without changing the folder structure or file name, I can save this file in this folder?