# Laminas\\Diactoros\\UploadedFile could not be converted to string

**URL:** <https://discourse.cakephp.org/t/laminas-diactoros-uploadedfile-could-not-be-converted-to-string/11094>\
**Category:** Need Help\
**Tags:** help\
**Created:** [March 28, 2023, 7:48am UTC](https://discourse.cakephp.org/t/laminas-diactoros-uploadedfile-could-not-be-converted-to-string/11094 "2023-03-28T07:48:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![user\_looser](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/user_looser/32/2161_2.png) [@user\_looser](https://discourse.cakephp.org/u/user_looser)\
**Post date:** [March 28, 2023, 7:48am UTC](https://discourse.cakephp.org/t/laminas-diactoros-uploadedfile-could-not-be-converted-to-string/11094/1 "2023-03-28T07:48:04Z")

</div>

Hi everybody, have you ever encoutered with “Object of class Laminas\Diactoros\UploadedFile could not be converted to string” error, when you do not attach file into a form, i.e. you send a filled form without attached file?

 ![Screenshot_2023-03-28_09-23-07](https://canada1.discourse-cdn.com/flex029/uploads/cakephp/original/2X/2/24f2fce0d1931d12163dbe31e3c546071f593d22.png)

In fact, in my form, I have three various input fileds for submitting files. Everything works perfectly, when I fill the form and attach all files. When I do not attach files at all or attach only 1 or 2 files, I am getting the error above.

Is there any way to enable empty attachments for Laminas\Diactoros\UploadedFile ?

Thank you very much!

My controller code is here:

 ![sources_controller_add](https://canada1.discourse-cdn.com/flex029/uploads/cakephp/original/2X/3/32a0cc5b1373ea5c044926b6a644feb52f551149.png)
