Skip to content
Advertisement

PHP – Uploading multiple files

I’m working on a plugin for wordpress and I want to be able to upload multiple pictures from a form. Right now when I have a form for two pictures and submit it empty, my $_FILES array looks like this:

JavaScript

Now the problem is that I want to use wordpress’ upload handler, wp_handle_upload. It expects the $_FILES array as an argument, but only with one file. I guess it can only be two arrays deep, not three as mine is. So I’m wondering if there’s a way to submit the files one at a time from the $_FILES array. The files have the same key in each array.

EDIT: Changed the post since I learned that the wp_handle_upload wants the $_FILES array as argument.

Advertisement

Answer

Try:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement