Yii3.0 can't upload files with only a file name

this the dump files information

array(1) { [“attach_files”]=> array(1) { [0]=> object(HttpSoft\Message\UploadedFile)#2703 (7) { [“stream”:“HttpSoft\Message\UploadedFile”:private]=> NULL [“file”:“HttpSoft\Message\UploadedFile”:private]=> NULL [“size”:“HttpSoft\Message\UploadedFile”:private]=> int(0) [“error”:“HttpSoft\Message\UploadedFile”:private]=> int(6) [“clientFilename”:“HttpSoft\Message\UploadedFile”:private]=> string(12) “DCC_0136.jpg” [“clientMediaType”:“HttpSoft\Message\UploadedFile”:private]=> string(0) “” [“isMoved”:“HttpSoft\Message\UploadedFile”:private]=> bool(false) } } }

How do you implement uploads?

just from the contact page
and from jQuery-File-Upload (ajax)

Do you mean it doesn’t work in demo? demo/src/Contact at master · yiisoft/demo · GitHub

yes, i tried upload image with ajax,it does’t work ,then try the demo contact page
$attachFiles = $request->getUploadedFiles();
var_dump($attachFiles);
, the same ,

it seems there is problems with my server,
can’t create tmpfile() when upload, i will check ,thank you


it worked after set php upload_tmp_dir
and upgrade the system, now php version is 8.0.9
i don’t know what make it works

1 Like

Liklely it’s permissions.

yes,thank you very much