cancel
Showing results for 
Search instead for 
Did you mean: 

B1 Service Layer - Uploading Attachments - Empty file

claudiocalabresi
Explorer
0 Kudos

 

Dear Experts,

When I upload a jpeg file to a remote server via Service Layer, the file is created in temp folder and in the SAP attachment folder. Also a new entry is created in the ATC1 table.
However, the upoaded file is empty and cannot be opened.

File size on my local PC (before the upload) is: 3166 bytes
File size on SAP attachment folder (after the upload) is: 796 bytes

If I try to open it with paint, I have this error:
Error message "Paint cannot read this file. This is not a valid bitmap file, or its format is not currently supported"

If I open it with Notepad, I see this text content:
<binary data>


Service Layer temp folder (located on the server where the Service Layer runs):
C:\Windows\Temp\ServiceLayer\Attachments2

 

I use Postman:

POST Request:

https://[RemoteServerAndPort]/b1s/v1/Attachments2

 

Request Header:

Content-Type: multipart/form-data; boundary=WebKitFormBoundaryUmZoXOtOBNCTLyxT


Request Body (type text):

--WebKitFormBoundaryUmZoXOtOBNCTLyxT
Content-Disposition: form-data; name="files"; filename="line8.jpeg"
Content-Type: image/jpeg

<binary data>
--WebKitFormBoundaryUmZoXOtOBNCTLyxT--

 

Response body:

{
"odata.metadata": "https://[RemoteServerAndPort]/b1s/v1/$metadata#Attachments2/@Element",
"AbsoluteEntry": 2196,
"Attachments2_Lines": [
{
"AbsoluteEntry": 2196,
"LineNum": 1,
"SourcePath": "C:\\Windows\\TEMP\\ServiceLayer\\Attachments2/",
"FileName": "line8",
"FileExtension": "jpeg",
"AttachmentDate": "2024-05-15T00:00:00Z",
"Override": "tNO",
"FreeText": null,
"CopyToTargetDoc": "tNO",
"CopyToProductionOrder": "tNO"
}
]
}


How can I upload a jpeg file using Service Layer please?

Thank you!
Claudio

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi claudiocalabresi,

What is the current SAP Business One version and patch where the issue is reproducible for you?

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

View Entire Topic
claudiocalabresi
Explorer
0 Kudos

Hi Ankit,

The version is:

SAP B1 10.0 (10.00.191) FP 2202 - SQL version

Thanks, Kind Regards,
Claudio