Title: Adding Uploader To PHP File.
Last modified: August 24, 2016

---

# Adding Uploader To PHP File.

 *  [BackpackersUnion](https://wordpress.org/support/users/backpackersunion/)
 * (@backpackersunion)
 * [11 years ago](https://wordpress.org/support/topic/adding-uploader-to-php-file/)
 * Hi Ckchaudhary,
 * Great job on this plugin!
 * I have a few different ways that users can message each other (Two different 
   pop-up windows that use the BuddyPress message system). Is there anyway to add
   the file uploader and plugin functionality to these windows?
 * I tried just pasting:
 *     ```
       <div class="bp_msgat_ui_wrapper">
       	<label>
       		<?php _e( 'Add an attachment','bp-msgat' );?><br>
       	</label>
       	<small><em><?php _e( 'Allowed file types : ', 'bp-msgat' ); echo implode( ', ', bp_message_attachment()->option('file-types') ); ?></em></small>
       	<p><button class="button button-secondary" id="btn_msgat_upload" name="btn_msgat_upload"><?php _e( 'Choose file', 'bp-msgat' );?></button></p>
       </div>
       ```
   
 * into the pop-up windows PHP file, but I’m sure I need to let the plugin know 
   where to enable the functions, scripts etc.
 * Thanks for your hard work on this! You did an excellent job!
 * All the best,
    Carl
 * [https://wordpress.org/plugins/buddypress-message-attachment/](https://wordpress.org/plugins/buddypress-message-attachment/)

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

 *  Plugin Author [ckchaudhary](https://wordpress.org/support/users/ckchaudhary/)
 * (@ckchaudhary)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/adding-uploader-to-php-file/#post-6181821)
 * Hi Carl,
    Adding the attachments ui to any form will require you to do 2 things:
    1. Enqueue plugin’s js files. By default plugin loads its script, styles only on
       buddypress’ default compose message screen. You can copy code from function 
       add_css_js in wp-content\plugins\buddypress-message-attachment\includes\actions.
       php line #48
    2. Add attachment’s ui to your form – Plugin has a filter specifically for this
       purpose. Define a custom action call in your form and add that action name in
       the list of actions at wp-content\plugins\buddypress-message-attachment\includes\
       actions.php line #38 using the filter defined there.
 * That should be all you need to do. I understand it’ll be difficult to implement
   for non-programmers. I’ll soon write a blog post about this in detail.
 *  Thread Starter [BackpackersUnion](https://wordpress.org/support/users/backpackersunion/)
 * (@backpackersunion)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/adding-uploader-to-php-file/#post-6181822)
 * Hi Ckchaudhary,
 * Thanks for helping with this 🙂
 * I was able to accomplish ‘Part 2’ but got stumped with ‘Part 1’, Enqueuing the
   JS. Will the `public function add_css_js(){` code (Assuming line 48 to line 90?)
   need to be copied into the pop-up window php file? Or is there another way to
   load the script when the pop-up window is triggered.
 * This pop-up windows can be triggered on any of the sites pages by opening a menu
   and clicking on a users icon.
 * I’ve worked with WordPress a lot but very novice with code, so as much detail
   as your willing to give is appreciated.
 * Thanks again for taking the time to help!
 * Regards,
    Carl

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

The topic ‘Adding Uploader To PHP File.’ is closed to new replies.

 * ![](https://ps.w.org/buddypress-message-attachment/assets/icon-256x256.png?rev
   =1108347)
 * [BuddyPress Message Attachment](https://wordpress.org/plugins/buddypress-message-attachment/)
 * [Support Threads](https://wordpress.org/support/plugin/buddypress-message-attachment/)
 * [Active Topics](https://wordpress.org/support/plugin/buddypress-message-attachment/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/buddypress-message-attachment/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/buddypress-message-attachment/reviews/)

## Tags

 * [move](https://wordpress.org/support/topic-tag/move/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [window](https://wordpress.org/support/topic-tag/window/)

 * 2 replies
 * 2 participants
 * Last reply from: [BackpackersUnion](https://wordpress.org/support/users/backpackersunion/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/adding-uploader-to-php-file/#post-6181822)
 * Status: not resolved