Download a File to a specific folder - WebClient BC

With the web client, The function DownloadFromStream doesnt allow to specify the client folder where to save the file. Every file is saved to the browser default transfer folder.

In my scenario I want to save a txt file to a pre configured folder.

TempFile.CREATETEMPFILE();

TempFile.WRITE('abc');

TempFile.CREATEINSTREAM(NewStream);

DOWNLOADFROMSTREAM(NewStream,'','MyFolderPath','',MyFileName);


Whats the correct approach to apply on WebClient?

Answers

  • PhoguePhogue Posts: 15Member
    edited 2019-08-09
    Have you tried using the DownloadToFile function in CU 419 ? DownloadToFile(ServerFileName, ClientFileName)?

    Or if that doesn't work, how about just calling the DownloadHandler function (also in CU 419) directly?
  • martinhocosta88martinhocosta88 Posts: 27Member
    I've tried bothand I get the following error. It seems its not able to create the temp file.
    nww0vi4wvu2z.png
  • PhoguePhogue Posts: 15Member
    edited 2019-08-09
    Ignore this comment, I mistakenly overlooked you were using CREATETEMPFILE, and posted irrelevant advice, sorry.
  • martinhocosta88martinhocosta88 Posts: 27Member
    I have the following:

    FileOutFile.CreateTempFile;
    tempFilename := FileOutFile.Name;
    (...)
    FileOutFile.CreateInStream(NewStream);
    FileMgt.DownloadToFile(TempFileName, FileNameExp); //instead of DownloadFromStream
    FileOutFile.Close();

    Getting the following error:
    5yxv8npt27dp.png

  • nav_studentnav_student Posts: 169Member
    Cehck if Event Viewer could give you more details. I've seen before on previous versions where I/O error was related with the file being used by another process.
Sign In or Register to comment.