WordPress.org

Ready to get started?Download WordPress

Forums

Overriding wp_handle_upload to crosspost to a CDN (6 posts)

  1. rylab
    Member
    Posted 5 years ago #

    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.

  2. rylab
    Member
    Posted 5 years ago #

    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.

  3. dspilka
    Member
    Posted 5 years ago #

    Hi,

    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?

    Thanks!

  4. dirtyBlueJeans
    Member
    Posted 5 years ago #

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

    Thanks.

  5. RyanWilliams
    Member
    Posted 5 years ago #

    Ditto. :)

  6. byoung2
    Member
    Posted 5 years ago #

    Try this plugin:
    http://swearingscience.com/cdn-tools/

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic