cURL - Send 2+ files using the same parameter name ("file[]")
オープン
まだ誰も着手していません。
Extension: curl
Feature
Status: Verified
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.2k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 96
説明
Description
The pull request https://github.com/php/php-src/pull/8292 made it possible to send an array of parameters of the same name.
However, it doesn't seem to support files:
I'm using PHP 8.3, but I'm not succeeding in doing this:
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: multipart/form-data'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'file' => [
new CURLFile($file1, posted_filename: 'File1.jpg'),
new CURLFile($file2, posted_filename: 'File2.jpg')
]
]);
PHP Fatal error: Uncaught Error: Object of class CURLFile could not be converted to string
Would it be possible to fix this, please?
Thank you very much!
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、issue の再現手順と pull request 8292 で行われた以前の配列パラメーター変更を手掛かりに、CURLOPT_POSTFIELDS、CURLFile の値、multipart/form-data 配列に対する PHP cURL の処理を追跡します。同じフィールド名に 2 つの CURLFile オブジェクトを指定した場合の動作を確認します。両方のファイルがオブジェクト変換の fatal error なしにエンコードされて送信され、回帰テストのカバレッジが追加されていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c, php
- 領域
- api, backend
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 58/100