[DOCUMENTATION] CUploadedFile::getInstancesByName behavior is not correctly documented #1234

teo1978 opened this Issue Aug 15, 2012 · 0 comments


None yet
2 participants

teo1978 commented Aug 15, 2012

From the documentation of CUploadedFile::getInstancesByName($name) http://www.yiiframework.com/doc/api/1.1/CUploadedFile#getInstancesByName-detail

"Returns an array of instances for the specified ARRAY name. "

This seems to imply that it will only return uploaded files that are elements of an array $_FILES[$name] or of any nested array inside it (as the note remarks: "Please note that this array will contain all files from all subarrays regardless how deeply nested they are").

While it does return all those, it will also return any file whose name just STARTS WITH $name.
This should be properly documented.

Actually, if there existed a method such as CUploadedFile::getAllInstances() to retrieve ALL uploaded files, I'd almost say that the best would be to change the actual method behavior to match the current documentation.

But since there is no such method and it is of VITAL importance to be able to get all instances, I like the current behavior because it provides the only way to get all the instances by calling CUploadedFile::getInstancesByName('') (the only way without jumping into a lower level and accessing $_FILES directly)

@ghost ghost assigned samdark Sep 9, 2012

@samdark samdark closed this in 7956509 Sep 9, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment