Support » Plugins » Media Upload Conversion

  • Hi all

    I’m trying to get the media uploader to work with a .stl file extension. The plan is to intercept the file after the uploader is triggered from the wordpress media center, run a conversion script and then pass the resulting browser-renderable format (x3dom if you’re interested) to the media center for storage (as it would for a simple png). The problem I’m having is in trying to intercept the file from the uploader, leading to the following questions.

    1. Can someone demonstrate the general process of how wordpress handles media uploads. Include any actions and filters that are vital to a successful upload of that particular media.

    2. Is there a hook/filter that can also allow me to customize how it’s stored in the file system? That would also be nice.

    3. The following are filters that seem to be of use but are not doing exactly what I need:

    //add_filter( ‘media_upload_tabs’, ‘media_upload_tabs’); //hide media tabs
    //add_filter( ‘media_send_to_editor’, ‘media_send_to_editor’ ); //to modified the string send by javascript
    //add_filter( ‘media_upload_form_url’, ‘media_upload_form_url’ ); //used to send new parameter

    4. The best option is below but not sure exactly how to leverage it?

     * This handles the file upload POST itself, creating the attachment post.
     * @since 2.5.0
     * @param string $file_id Index into the {@link $_FILES} array of the upload
     * @param int $post_id The post ID the media is associated with
     * @param array $post_data allows you to overwrite some of the attachment
     * @param array $overrides allows you to override the {@link wp_handle_upload()} behavior
     * @return int the ID of the attachment
    function media_handle_upload($file_id, $post_id, $post_data = array(), $overrides = array( ‘test_form’ => false )) {

  • The topic ‘Media Upload Conversion’ is closed to new replies.