Search code examples
c#server-side

How to make file path from stream for class or method that need to use it


I am looking for idea or hint how fill method/class that need file path in parameter.

f.g

InserFileIntoLibrary(string filePath);

where file path is not C:/ and any other buffored temp directory. Is it possible to make some symulation of file directiory and insert it's file.path value into that string? Problem to solve is that i am sending file between servers, and on other server i have method that can only use memory from program and NO DIRECTORY to buffor/temp this file/stream. Someone has this kind of problem? Or know where to look?

p.s sorry for my english, any kind of corrects are welcom.


Solution

  • Basically no - if you can't save file to disk than you can't get path to such file.

    In theory you may be able to create (or use existing) virtual file system, but depending on your budget it may not be acceptable solution. One built-in version is to use WebDAV to access server as \\host\file...

    I'd recommend first try to save streams locally - temp folder is normally writable and getting permissions to do so may be way easier.

    Also make sure there is no API that performs same task but accepts streams.