I have developed a module with a form, one of the fields is a file upload. It all works correctly including saving the file to disk but Drupal shows this error message:

warning: Invalid argument supplied for foreach()...

I am uploading a jpg which is one of the allowed file types. Can someone point me in the right direction to remove the message?

Thanks!

Comments

jaypan’s picture

Probably something wrong with your code.

Contact me to contract me for D7 -> D10/11 migrations.

judeson’s picture

There might be some problem with image name which you have uploaded. Because it will not allow some special characters. And also check file system and file system path. I hope it will work. If you have any queries please let me know.