Sample project for file upload

Hi,
I was cheking the new file upload demo and I was wondering how to create client using THttpClient to upload the file(mulipart upload).

Any hint?

Thanks in advance,

Omar Zelaya

Multipart is intended to respond to browser requests. Even though you can of course create any request using THttpClient (just setting the proper headers and raw byte content), when using THttpClient you have more flexibility to send data to the server, so you can use easier method for you. Is there a reason for using multipart format?

Hi,

I'm asking becuase if I want to upload a 1GB file, with THttpClient looks like I have to load all the file in memory. With Indy I have done it using TIdMultipartFormDataStream.

Thanks in advance,

Omar Zelaya

That has more to do with the THttpClient mechanism than multipart itself. Indeed THttpClient requires you to provide all the request body before sending it to the server - regardless if it's multipart or not.

We have plans to allow you to upload it via stream so parts of the content will be uploaded as you provide them. But then it can be used with multipart format or just any other format - even raw binary.