Upload file with webwrite including file and data parameter
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi, I try to send a HTTPS Post request using webwrite but it seems I cannot provide all the necessary data as I get a "Bad Request" response. In Python the request works and is as simple as
uri = 'https://........'
response = requests.post(uri,
headers = {'X-Auth-Token': SOMETOKEN},
files = {'file1': FILEREADED},
data = {'createGroupForEachFile': 'false'})
In Matlab (2015 and 2017) I tried many different combinations of giving this data to webwrite and weboptions, but I always get the "bad request" response. What am I doing wrong? Is it possible to give "files" and "data" at the same time with Matlab webwrite? Here some example code (with which I get the bad request). I also tried around with weboptions and MediaType option without success:
url = 'https://......';
opt = weboptions;
opt.RequestMethod = 'post';
opt.HeaderFields = {'X-Auth-Token', SOMETOKEN};
response = webwrite(url,'files',{'file1',FILEREADED},'data',{'createGroupForEachFile': 'false'},opt);
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Web Services에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!