• Hi, i’m trying to write a plugin and I need the admin to have the option to upload files(images). As of the moment i got:

    <form method="post" action="options.php" enctype="multipart/form-data">
        <?php wp_nonce_field('update-options'); ?>
        <table width="100%" style="text-align: left;">
            <tr valign="top">
                <th width="250" scope="row">Background Image</th>
                <td>
                    <input name="mypg_image" type="file" id="mypg_image" value="" />
                </td>
            </tr>
            <tr valign="top">
                <th width="250" scope="row">Image Title</th>
                <td>
                    <input name="mypg_title" type="text" id="mypg_title" value="<?php echo get_option('mypg_title'); ?>" />
                </td>
            </tr>
        </table>
    
        <input type="hidden" name="action" value="update" />
        <input type="hidden" name="page_options" value="mypg_title, mypg_image" />
        <p>
            <input type="submit" value="<?php _e('Save Changes') ?>" />
        </p>
    </form>

    and there is no problem working with the text fields, but how should a file upload be managed ?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to make a plugin with file upload’ is closed to new replies.