# PHP-cURL code with multiple uploaded files

**URL:** <https://community.postman.com/t/php-curl-code-with-multiple-uploaded-files/74703>\
**Category:** Help Hub\
**Tags:** php\
**Created:** [January 31, 2025, 2:18am UTC](https://community.postman.com/t/php-curl-code-with-multiple-uploaded-files/74703 "2025-01-31T02:18:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joint-operations-p14](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@joint-operations-p14](https://community.postman.com/u/joint-operations-p14)\
**Post date:** [January 31, 2025, 2:18am UTC](https://community.postman.com/t/php-curl-code-with-multiple-uploaded-files/74703/1 "2025-01-31T02:18:59Z")

</div>

I have a request with multiple files on a variable called files. The request runs correctly in Postman. I need it to run in PHP.

The Generated PHP-cURL code looks wrong. It contains:  
CURLOPT\_POSTFIELDS =\> array(‘files’=\> new CURLFILE(‘SOrf7-JsS/file1.csv’),‘files’=\> new CURLFILE(‘MXudzPgrW/file2.csv’), …

That’s duplicate keys in a PHP array.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [January 31, 2025, 10:38am UTC](https://community.postman.com/t/php-curl-code-with-multiple-uploaded-files/74703/2 "2025-01-31T10:38:53Z")

</div>

Hey @joint-operations-p14 👋

Welcome to the Postman Community! :postman:

Glad to see this is working for you in Postman - This sounds like it’s probably better asked on Stackoverflow or a PHP specific Community. 😓

Doing a quick search, I found something like this but I wouldn’t know if it works:

```auto
$postFields = array(
    'files[]' => new CURLFile('file.jpeg'),
    'files[]' => new CURLFile('file.png')
);

CURLOPT_POSTFIELDS => $postFields,

```

I have no doubt that there are some PHP masters in this Community but you might get a faster solution if this is posted elsewhere. 🙏
