正在发送空< input type =" file">字段与Curl上PHP [英] Sending empty <input type="file"> fields with Curl on PHP

查看:180
本文介绍了正在发送空< input type =" file">字段与Curl上PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

欢迎大家。

这是一个问题:
我试图使用PHP和CURL将数据与文件发送到服务器。
服务器接受6张照片的数据。
如果在$ _FILES数组中有少于6个项目 - 这是一个错误。

Here is a problem I have: I'm trying to send data with files to server using PHP and CURL. Server accepts data with 6 photos. And if there are less than 6 items in $_FILES array - it`s an error.

所以如果我发送所有6张照片,一切都完美。
但是如果有更少的照片,那么值为空的照片到$ _POST数组。

So if I send all 6 photos, everything goes perfectly. But if there are less photos, than value with empty photo goes to $_POST array.

我读Curl文档,但不能找到这样的可能性。
如何使用CURL发送文件类型的空值?

I read Curl documentation but couldn`t find such possibility. How can it be done with CURL to send an empty value of File type?

推荐答案

它的工作原理:

curl  -F "file_1=@files.zip" -F "file_2=@/dev/null;filename=" -F "file_3=@/dev/null;filename="

这篇关于正在发送空< input type =" file">字段与Curl上PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆