Import attachment in Web Client is not working

Hi All,

[Version: NAV 2016]

In a customized page, I newly kept an feature for Importing, Exporting and Deleting an attachment. I can able to Import/Export/Delete without any issues in Windows client. When I try to import an attachment from web client, immediately the web page gets closed and am getting below error:

An error has occurred

A server error has occurred, and the content cannot be displayed. Refresh the page or open a new browser window.

Restart ->


In Customized Table: Attachment Table, I wrote below function for Import.

Local variable of ImportAttachment function:
Parameter: RecIDToImport (RecordID)
Variable: AttachRecordRef (RecordRef)

[b]ImportAttachment(RecIDToImport : RecordID)[/b]

INIT;
"Line No." := "Line No." + 10000;
"Primary Key" := RecIDToImport;
Filename := FileManagement.BLOBImportWithFilter(TempBlob,Text002,'','*.*|','*.*');
IF Filename = '' THEN
  EXIT;
Attachment := TempBlob.Blob;
"Name of the File" := FileManagement.GetFileName(Filename);
Extension := '.' + FileManagement.GetExtension(Filename);
INSERT;

IF Attachment.HASVALUE THEN
  MESSAGE(Text005,Filename);

I wrote below code in page OnAction..

Global variables:
AttachmentRecLineNo (Integer)
AttachmentRecNameofFile (Text)
AttachMgmt2 (Record) Attachment Table

AttachmentRecRef.OPEN(DATABASE::"Purch. Request Header");
AttachmentRecRef.SETPOSITION(GETPOSITION);
AttachmentRecID := AttachmentRecRef.RECORDID;
AttachmentRecRef.CLOSE;
AttachmentManagement.ImportAttachment(AttachmentRecID);
AttachmentManagement."Document No." := "No.";
AttachmentManagement.MODIFY;

What is missing and can anybody let me know how to sort it out?

Thanks in advance,
Aarvi.

Comments

  • Aravindh_NavisionAravindh_Navision Member Posts: 258
    It is been solved.

    Just modified the line..
    Filename := FileManagement.BLOBImportWithFilter(TempBlob,Text002,'','*.*|','*.*');
    

    with..
    Filename := FileManagement.BLOBImportWithFilter(TempBlob,Text002,'','All Files (*.*)|*.*','*.*');
    

    Thanks.
  • ishyampandeyishyampandey Member Posts: 22
    Hi @Aravindh_Navision , Do you have any idea about multiple file upload using the same this file mgt. functionality. Thanks
  • Aravindh_NavisionAravindh_Navision Member Posts: 258
    edited 2021-02-19
    Hi Shyam,

    Sorry for the late reply. I do not have any idea as of now. But let me check and let you know.

    Thanks.
Sign In or Register to comment.