directus-php-sdk icon indicating copy to clipboard operation
directus-php-sdk copied to clipboard

Multiple files in request body

Open ShadXst opened this issue 2 years ago • 3 comments

Hello! Thank you guys for your work, amazing solution, but I found an issue. Directus.php on line 148 has issues with $_FILES.

When I tried to get files from frontend request body I've got an error: $_FILES["file"] can't read with "file" key if I've sent form data where key is "files". Changing form data files key to "file" of course will not change the situation because it will try to read $_FILES["file"]['tmp_name'] where 'tmp_name' is not a string but array with temp names of each file.

The only one way I can upload files right now is by sending each one in separate request.

ShadXst avatar May 18 '22 13:05 ShadXst

apart from that, the files_create() only works with the filename file. Many Array offsets are using $data["file"]["name"]

torstenhoegel avatar Jul 13 '22 06:07 torstenhoegel

Hi @ShadXst,

I will have a look at this for my next release which I hope will be a big one. Not had a chance to work on this for a while but hopefully will be able to shortly.

alantiller avatar Sep 20 '22 09:09 alantiller

Hi, can have a example please ? I have the same problem

ghost avatar Apr 07 '23 20:04 ghost