WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Change New Post Form Enctype

[Resolved] Change New Post Form Enctype

  • 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.)

Viewing 1 replies (of 1 total)
  • 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’;”

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Change New Post Form Enctype’ is closed to new replies.