HttpAPI upload Image and Video

[with reference to this question and answer ] (HttpAPI Image)

if I upload a image / video in body, can I use VariantBinaryToRawBinary to direct saved the uploaded stream to a file? Any conversion is needed?

if mp4 is large like 500M, can any way to cut into small part and send and keep track the upload progress?

Hello

Body of the HttpAPI request is expected to be a valid JSON data. So you just cannot pass there a raw binary stream. Request body will look like

{
body: “…base-64 encoded content here…”
}
This might work fine for smaller files.

However if your service requires multiple and fast file uploads or you need to allow upload of large files the the best approach would be to implement a separate Http dispatcher that would accept raw binary data as request body and would allow chunked data transfer.

Client-side data can look like https://planetjon.ca/3482/uploading-large-files-with-ajax-and-jquery

Hope that helps