Import picture in RTC

Lec11Lec11 Member Posts: 91
edited 2013-07-30 in NAV Three Tier
Hello,

I want to import several picture files at once in RTC from a specified folder. I created the following functions:
GetPictures(FilesPath : Text[100])
DirectoryInfo := DirectoryInfo.DirectoryInfo(FilesPath);
List := DirectoryInfo.GetFiles();
enumerator := List.GetEnumerator();
WHILE enumerator.MoveNext DO BEGIN
FileInfo := enumerator.Current();
IF FileInfo.Extension IN THEN
GetSinglePicture(FileInfo.FullName,FileInfo.Name,FileInfo.Extension);
END;

GetSinglePicture(FilePath : Text[100];FileName : Text[100];Extension : Text[10])
"3TierAutoMgmt".BLOBImport(TempBlob,FilePath,FALSE);
--rest of code where I'm parsing the file name--

But when importing, the dialog window appears where I should choose the file.
I replace the BLOBImport line with the code from the function, using magicpath instead of folder and I receive the error
File was not found.

Am I missing something here?

Thanks!

Answers

  • Lec11Lec11 Member Posts: 91
    Noone? I'm not asking for the code, I only want a hint. Shouldn't BLOBImport function be enough to upload the file to the server?
  • Lec11Lec11 Member Posts: 91
    So nobody imports pictures in Nav. Ok, i'll manage it on my own.
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    I have used below code successfully in NAV2013 to import files (which resides on the client) into a BLOB-field, without any dialogs:
    ltxtServerFileName := lcduFileMgt.UploadFileSilent(ltxtClientFileName);
    ltmpAttachment.INIT;
    lcduFileMgt.BLOBImportFromServerFile(lrecBlobref,ltxtServerFileName);
    ltmpAttachment.Attachment := lrecBlobref.Blob;
    ltmpAttachment."File Extension" := COPYSTR(UPPERCASE(lcduFileMgt.GetExtension(ltxtClientFileName)),1,250);
    IF FILE.ERASE(ltxtServerFileName) THEN;
    
    Vars:
    lcduFileMgt : Codeunit 419
    lrecBlobref : Record 99008535
    ltmpAttachment : TEMPORARY Record 5062
    
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Lec11Lec11 Member Posts: 91
    I've managed to import the pictures without dialog by using the SilentUpload function from Nav 2009 and then importing the server file.

    Thanks, Luc!
Sign In or Register to comment.