# Composer drag and drop with custom uploader

**URL:** <https://meta.discourse.org/t/composer-drag-and-drop-with-custom-uploader/204775>\
**Category:** Development\
**Created:** [September 29, 2021, 4:26pm UTC](https://meta.discourse.org/t/composer-drag-and-drop-with-custom-uploader/204775 "2021-09-29T16:26:39Z")\
**Posts on this page:** 3\
**Page:** 1

## AI-generated summary

The discussion focuses on extending the drag and drop functionality on the Composer to allow for custom JavaScript uploads. [Sören_Geier](/t/-/204775/1) wants to integrate their existing uploader with the onebox functionality, enabling features like uploading large video files to Google Drive and inserting specific iframe code into the Composer.

[Falco](/t/-/204775/3) provides a relevant example, pointing to the [Client side image optimization enabled by default](https://meta.discourse.org/t/client-side-image-optimization-enabled-by-default/197617) feature, which uses a hook to achieve similar functionality. The hook can be found in the [register-media-optimization-upload-processor.js](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/initializers/register-media-optimization-upload-processor.js) file. However, it's noted that the implementation might be affected by the transition from jQuery.FileUpload to Uppy.

<div class="post-metadata">

**Author:** ![Sören\_Geier](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/s%C3%B6ren_geier/32/235234_2.png) [@Sören\_Geier](https://meta.discourse.org/u/S%C3%B6ren_Geier)\
**Post date:** [September 29, 2021, 4:26pm UTC](https://meta.discourse.org/t/composer-drag-and-drop-with-custom-uploader/204775/1 "2021-09-29T16:26:39Z")

</div>

Hi,  
I would like to extend the drag and drop functionality on the composer to allow for a more sophisticated process to kick off. so for example if ppl drag a large video file there I want custom Javascript to fire in order to upload that file to Google drive. On completion i want to insert specific iframe code into the composer.

now i have all this working already except that it currently only works via a toolbar icon and a modal that pops up. i want to bring both worlds together now by extending the existing onebox funtionality.

can anyone point me to documentation how I can hook into those events?

thanks

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [September 29, 2021, 5:01pm UTC](https://meta.discourse.org/t/composer-drag-and-drop-with-custom-uploader/204775/2 "2021-09-29T17:01:54Z")

</div>

Sounds cool!

I can’t tell you exactly where to look, but where I’d look is that code the auto-detects code blocks. There has been some discussion of that somewhat recently, but my quick search doesn’t yield anything.

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [September 29, 2021, 7:49pm UTC](https://meta.discourse.org/t/composer-drag-and-drop-with-custom-uploader/204775/3 "2021-09-29T19:49:39Z")

</div>

> [@Sören\_Geier](#):
>
> so for example if ppl drag a large video file there I want custom Javascript to fire in order to upload that file to Google drive. On completion i want to insert specific iframe code into the composer.

> [@Sören\_Geier](#):
>
> can anyone point me to documentation how I can hook into those events?

This is exactly what the recent [Client side image optimization enabled by default](https://meta.discourse.org/t/client-side-image-optimization-enabled-by-default/197617) does. You can see the hook here:

[https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/initializers/register-media-optimization-upload-processor.js](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/initializers/register-media-optimization-upload-processor.js)

One big warning, is that we are moving from jQuery.FileUpload to Uppy in this release, so there are currently two ways of doing everything regarding this.
