这样的,我的目的是模拟一个html页面的表单提交。
对方网站提供了一个页面form表单,表单里有3个文件上传框
<input type="file" name="upload1">
<input type="file" name="upload2">
<input type="file" name="upload3">
我在页面上手工操作,只上传1个或者2个文件是没有问题的,但是我用php写了curl去提交,下面这样写post参数,只上传2个
$data = array("upload1"=>"@/file/path1", "upload2"=>"@/file/path2");
则对方服务器返回错误,意思就是无法读取文件内容;如果
$data = array("upload1"=>"@/file/path1", "upload2"=>"@/file/path2", "upload3"=>"");
也返回错误。
求如何只传1个或者2个文件