Hi All,
I am fetching a file stream from temp blob storage and I wanted to store it in a local path through code. I have tried the below code, but it is prompting a saveAs dialog whether to save the file to download folder, but I want the file stream to be saved to a specific path automatically through code itself. Please suggest a solution for this issue.
public static void main(Args _args)
{
Str1260 fileUrl;
container readCon;
FilePath tempDir = "C:\\Temp\\DIXF\\file.txt";
FileUploadTemporaryStorageResult result = File::GetFileFromUser() as FileUploadTemporaryStorageResult;
if (result && result.getUploadStatus())
{
fileUrl = result.getDownloadUrl();
//info(fileUrl);
readCon = Binary::constructFromMemoryStream(result.openResult()).getContainer();
System.IO.StreamReader sReader = new System.IO.StreamReader(result.openResult());
// Set file contentn string
str fileContent = sReader.ReadToEnd();
// Save file
File::SendStringAsFileToUser(fileContent, tempDir);
}
}
Thanks in Advance,
Gopinath M.