Support » Fixing WordPress » Overriding wp_handle_upload to crosspost to a CDN

  • Hello,
    The new flash-based media uploader works great for uploading files locally. However we recently moved to hosting all the media for our site on a CDN. There is no easy way to override the wp_handle_upload function (it does not have an if function_exists()) block around it like most) to use my CDN-posting function instead of doing a local file upload.

    I’ve written my own modified version of this function and have it working fine, but I really don’t want to commit changes to the vendor portion of the wordpress code in our repository. I’d like to make this change using our plugin instead, just like everything else I’ve done so far has been done… but I’m just not seeing a way to make that work without changing at least one line in the main WP source.

    How can I either override the wp_handle_upload function without modifying the wordpress codebase, or alternately set up the admin media uploader to use a different function (my own) to handle POSTs instead of using wp_handle_upload at all in that instance? Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Anyone… ideas? Can the next upgrade to WP put the usual “if (! function_exists())” type of check around the wp_handle_upload function, so it doesn’t overwrite our custom one when upgrading? Thanks.


    I’m looking into how to be able to upload content to a CDN as well. We’re moving our media over to a CDN as well and need to take advantage of it for uploaded media by bloggers. Have you made anymore progress on this front? How are you handling this now?


    Guys, would be great to know if you made any progress on uploading to CDN.


    Ditto. 🙂

    Try this plugin:

    So far it only works with Cloud Files CDN but others are coming

    From the site:
    * One click load all attachments and JS to a CDN
    * Transparently sideload new content (including images resized by WP!)
    * Automatically rewrite URLs on your blog to point at the CDN-loaded content.
    * Easy deactivation if you decide to stop using it. No messy fixes to get back to a pristine WP install. Just remove the plugin and everything will work fine!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Overriding wp_handle_upload to crosspost to a CDN’ is closed to new replies.