Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Unanswered

Spilt InStream into chunks

(0) ShareShare
ReportReport
Posted on by 7

Hi,
we use BC20 (On Premise).
We currently store files in Azure File Share. When I upload data, I use a stream and HTTP http request methods.
Azure only allows streams up to 4MB. If the stream is larger, it must be split into chunks.

FileName := FileMgt.BLOBImportWithFilter(TempBlob, 'Choose file', FileName, 'All Files (*.*)|*.*', '*.*');
TempBlob.CreateInStream(InStream, TextEncoding::UTF8);

WriteFrom(InStream);

How can is split the InStream into multiple chunks?

Regards

  • hubi777x Profile Picture
    hubi777x 7 on at
    RE: Spilt InStream into chunks

    I finaly found a solution by my own

    var
      CByte: Byte;

    // Copy binary data (byte by byte) from InStream into OutStream
    Blob1.CreateOutStream(OutStream);
    for i := 1 to ChunkSize do begin
      InStream.Read(CByte);
      OutStream.Write(CByte);
    end;

    // Copy OutStream to ChunkStream
    Blob2
    := Blob1;
    Blob2.CreateInStream(ChunkInStream, TextEncoding::UTF8);

    WriteFrom(ChunkInStream);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans