[wp-hackers] file uploading: maybe worth add a hook?

Francesco Terenzani f.terenzani at gmail.com
Thu Feb 22 10:12:36 GMT 2007


You could take the way to rename the uploaded file.

In your plugin I've removed:

remove_action( 'upload_files_upload', 'wp_upload_tab_upload_action' );
add_action( 'upload_files_upload', 'gmz_upload');

And add:

add_action('wp_handle_upload', 'gmz_rename');

The code of gmz_rename() and your plugin hacked is here:
http://www.terenzani.it/wp-hacker/uploadplus.phps
It seems working fine...

I've also modified your gmz_mangle_filename() function.

On 2/21/07, Pixline <supporto at pixline.net> wrote:
> Il giorno 21/feb/07, alle ore 16:01, Jennifer Hodgdon ha scritto:
> > add a line like this:
> >    $overrides = apply_filters( 'upload_overrides', $overrides );
>
> I really didn't know that was so simple... Seems like the solution in
> WP is quite always the easy way, I'm not used to that pleasant
> coding :-)
> I make a patch with your suggestion and the enhancement request on
> http://trac.wordpress.org/ticket/3831 , hoping it will be accepted.
> In that case my plugin will be 95 lines shorter :-).
>
> I definitively love wordpress.
> Thank You.
>
> Paolo
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


-- 
Globalwarming Awareness2007 GT Team
http://www.gt-globalwarming-awareness2007.org/
http://globalwarming-awareness2007.bloster.altervista.org/

http://www.terenzani.it/


More information about the wp-hackers mailing list