Options

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

  • Options
    PhoguePhogue Member Posts: 76
    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?
  • Options
    martinhocosta88martinhocosta88 Member Posts: 27
    I've tried bothand I get the following error. It seems its not able to create the temp file.
    nww0vi4wvu2z.png
  • Options
    PhoguePhogue Member Posts: 76
    edited 2019-08-09
    Ignore this comment, I mistakenly overlooked you were using CREATETEMPFILE, and posted irrelevant advice, sorry.
  • Options
    martinhocosta88martinhocosta88 Member Posts: 27
    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

  • Options
    nav_studentnav_student Member Posts: 175
    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.