Skip to:
Content
Pages
Categories
Search
Top
Bottom

can’t access $_FILES inside my plugin

  • Avatar of ckchaudhary
    ckchaudhary
    Participant

    @ckchaudhary

    hi all, i am trying to write a buddypress plugin. i hooked a file upload control (`name=’ma_file’ id=’ma_file’`) to the private message screen and its showing up there on the compose screen. now i have to access the file selected in the file upload control. m trying to access `$_FILES` inside a function i wrote in `messages_message_before_save` action. but `$_FILES` always returns blank. please help

Viewing 4 replies - 1 through 4 (of 4 total)
  • Avatar of ckchaudhary
    ckchaudhary
    Participant

    @ckchaudhary

    opps my bad! forgot that the form’s enctype attribute has to be set. if i edit the `wp-contentpluginsbuddypressbp-themesbp-defaultmemberssinglemessagescompose.php` file to set the forms enctype then it works. but then another problem, how do i set it through my plugin so that i dont have to go and edit that file manually. or is if possible in the first place? any work around?

    Avatar of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

    Ooh. Tricky. Does setting the attribute via javascript work?

    If you submit this as an enhancement ticket to https://buddypress.trac.wordpress.org, using your username and password from this site, we can change the template in BuddyPress 1.7 for you. If you can attach a patch, that would be even better :)

    Avatar of ckchaudhary
    ckchaudhary
    Participant

    @ckchaudhary

    yes javascript did work, thank you. i wonder why it didn’t cross my mind before :(
    and i did submit an enhancement ticket..

    Avatar of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.