Skip to main content

Notifications

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

Spilt InStream into chunks

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 229,928 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans