How to construct the body and upload the files of multipart/form-data
4 ビュー (過去 30 日間)
古いコメントを表示
I am trying to pass the files to the API interface with multipart/form-data. But I am not sure how to construct the body as below:
------WebKitFormBoundaryoeTA5ctzJ87vDL0x Content-Disposition: form-data; name="file"; filename="DefaultCsv.csv" Content-Type: application/vnd.ms-excel
------WebKitFormBoundaryoeTA5ctzJ87vDL0x--
I have written the codes like:
boundary='----WebKitFormBoundary52x5ruT8nrmA8Ek2'; body=sprintf('%s\n%s\n%s\n%s',boundary,'Content-Disposition:form-data;name="file";filename="DefaultCsv.csv"','Content-Type:application/vnd.ms-excel',boundary); body_ = matlab.net.http.MessageBody(body); body_.Payload=body;
But it does not work.
In addition how could I upload the files by this form?
0 件のコメント
回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Earth and Planetary Science についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!