httpclient icon indicating copy to clipboard operation
httpclient copied to clipboard

Multi form-data issues

Open gitaccxz opened this issue 4 years ago • 2 comments

This data how to send?

$BODY .= '------WebKitFormBoundary'.$BOUNDARY.$eol;
$BODY .= 'Content-Disposition: form-data; name="file"; filename="'.basename($cp).'"'.$eol;
$BODY .= 'Content-Type: image/'.pathinfo(basename($cp), PATHINFO_EXTENSION).$eol.$eol;
$BODY .= $Pic.$eol; 

Trying like this:

$request->addPostFile('file', $cp, basename($cp));
$request->addPostField('Content-Type', 'image/'.pathinfo(basename($cp), PATHINFO_EXTENSION));

Name field: file Filename: how to add? 2nd Line Content-Type: How to add? $Pic: image how to add?

gitaccxz avatar Nov 07 '21 15:11 gitaccxz

just need the following codes:

$request->addPostFile('file', $cp, basename($cp));

在 2021年11月7日,23:25,gitaccxz @.***> 写道:

$request->addPostFile('file', $cp, basename($cp));

hightman avatar Nov 07 '21 23:11 hightman

I tried but pic not uploaded

emma-eva avatar Nov 08 '21 08:11 emma-eva