Options

Loading a .txt file into a blob

lightninglightning Member Posts: 15
I want to load a .txt file into NAV, so i can store it later in a BLOB field in a table. tried this:

FileManagement.BLOBImportFromServerFile(TempBlob, FileName);

Where FileManagement is Codeunit 419
TempBlob is Record from TempBlob table
And FileName is acquired by choosing it from a dialog window earlier, so looks like: C:/Users/username/Desktop/myFile.txt

I get an Error "File does not exist" when clearly it does at that path, so maybe I'm doing something wrong
NAV 2017

Best Answer

  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    Answer ✓
    Hi,

    The file needs to be visible form the server side. You need to upload it to the server first, using
    ServerFileName := FileManagement.UploadFileSilent(FileName);
    
    before calling BLOBImportFromServerFile(TempBlob, ServerFileName)

    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03

Answers

  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    Answer ✓
    Hi,

    The file needs to be visible form the server side. You need to upload it to the server first, using
    ServerFileName := FileManagement.UploadFileSilent(FileName);
    
    before calling BLOBImportFromServerFile(TempBlob, ServerFileName)

    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Options
    lightninglightning Member Posts: 15
    It helped @Slawek_Guzek thank you very much, seems i don't fully yet understand how file management works in NAV
Sign In or Register to comment.