V
V
van93142021-09-30 19:22:13
C++ / C#
van9314, 2021-09-30 19:22:13

How to send zip archive from MemoryStream via WebClient?

I need to do this without saving the file on disk, that is, directly from the MemoryStream, the code below does not send anything, when I looked through Fiddler it just sends an empty request.
I use .NET 4.0, so I need to do this with the help of WebClient, I've been racking my brains for 4 days, I still don't understand how to implement it.

zip.AddEntry($"Info.txt", "test");
zip.Save(ms);
using (WebClient client = new WebClient())
    {
    using (Stream requestStream = client.OpenWrite(new Uri("http://test.com/getfile.php")))
        {
        ms.Position = 0;
        ms.CopyTo(requestStream);
        }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question