WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Change New Post Form Enctype (2 posts)

  1. nroussos
    Member
    Posted 7 years ago #

    Problem: I want to change the enctype (to 'multipart/form-data') of the main form on the post-new.php page, so that my plugin can upload a file when publishing. (I specifically do not want to use the built-in file attachments). Is this possible? (I've been trying to use javascript to no avail.)

  2. nroussos
    Member
    Posted 7 years ago #

    I found the answer shortly after posting.

    Two Options:
    1) edit the form file manually (not preferred because it's not exactly sustainable). It's in wp-admin/edit-form-advanced.php line 10.

    2) Javascript (I put mine as an onchange event on the file form field). "var postForm = document.getElementById('post'); postForm.encoding = 'multipart/form-data';"

Topic Closed

This topic has been closed to new replies.

About this Topic