Make it easier to upload files by using the file path instead of a stream variable #1449
SysProfile
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Add this public function or integrate it to work with UploadFile, for example:
object.UploadFile("path_file_local.txt", "/remote_name.txt", True)
public Stream GetFileStream(string filePath)
{
var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
var memoryStream = new MemoryStream();
fileStream.CopyTo(memoryStream);
fileStream.Close();
memoryStream.Position = 0L;
return memoryStream;
}
Beta Was this translation helpful? Give feedback.
All reactions