• Hello,

    I have added a meta box to my posts that is suppose to handle a file upload.

    I have ensured that everything is good in terms of my modifications but I can’t get the file to be uploaded.

    Can any work suggest a solution to this problem ?

    Alexander

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Mr. Alexander

    (@mr-alexander)

    One thing I noticed, when I add the form tag to the post meta box it gets eliminated, because it gets overwritten by the parent block, which doesn’t accept file uploads.

    Alexander

    This is, because the form in the source with id “post” doesn’t have attrib enctype with value “multipart/form-data”.

    So what You have to do is just add to it with a litle javascript.

    jQuery(document).ready(function(){
    
      jQuery("form#post").attr("enctype", "multipart/form-data");
    
    });

    Or You can edit wp source.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Upload File from Post Meta Box’ is closed to new replies.