[wp-hackers] something wrong with wp_unique_filename()

Davit Barbakadze jayarjo at gmail.com
Wed Jun 17 13:42:27 GMT 2009

I was messing with wp_handle_upload()
recently (trying to use it for my own uploads). It has a built-in
support for error generating and file naming operations override
(kinda twisted one). Or so it looks. Error reporting is ok. Unique
file name generation override seems wrong.

Here is the code:

Function takes optional argument - $unique_filename_callback, that
should point (if it is supplied) to the user-defined unique name
generating function. Now the problem is that default logic flow has
access to filename extension and callback doesn't. Hence it's
impossible to generate unique filename with proper extension manually.

Has anyone ever used this function?

David Barbakadze

More information about the wp-hackers mailing list