WordPress.org

Ready to get started?Download WordPress

Forums

image upload plugin enctype problem (request) (1 post)

  1. hikmetk
    Member
    Posted 5 years ago #

    hi.
    i wrote a plugin for a template which uses special meta keys
    (Thumbnail and Landscape).
    my plugin adds a <input type="file" ... > to dbx_page_advanced and
    dbx_post_advanced for simplify uploading images. also, plugin resizes
    the image, create thumbnail and adds watermarks to images. and insert
    them into the wp_postmeta table.
    the only problem is in wp-admin/edit-form-advanced.php i wanted to use
    $_FILES but there is no enctype="multipart/form-data" in <form>
    definition.
    i change 20+ sites uses this plugin when every wordpress update.. :(
    is it possible you add enctype to original wordpress?
    will it create a bug?

    function ry_resim_ekleme_formu() {
    echo '
    <div class="postbox">
    <h3>Upload Image</h3>
    <div class="inside">
    <div>
    <p>
    <label for="img1">Image:</label>
    <input type="file" name="img1" id="img1" />
    </p>
    </div>
    </div>
    </div>';
    }

    function ry_resim_kaydet() {
    /*
    i can't reach $_FILES in here.
    because there is no enctype definition in wp-admin/edit-form-advanced.php
    */
    }

    add_action('dbx_page_advanced', 'ry_resim_ekleme_formu');
    add_action('dbx_post_advanced', 'ry_resim_ekleme_formu');

    add_action('edit_post', 'ry_resim_kaydet');
    add_action('publish_post', 'ry_resim_kaydet');
    add_action('save_post', 'ry_resim_kaydet');
    add_action('edit_page_form', 'ry_resim_kaydet');

Topic Closed

This topic has been closed to new replies.

About this Topic