# 新上传类型的示例插件？

**URL:** https://meta.discourse.org/t/example-plugin-for-new-upload-type/84377
**Category:** Development
**Created:** [2018年四月2日 12:29 UTC](https://meta.discourse.org/t/example-plugin-for-new-upload-type/84377 "2018-04-02T12:29:38Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![vibraphone](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vibraphone/32/120233_2.png) [@vibraphone](https://meta.discourse.org/u/vibraphone)
#### Post date: [2018年四月2日 12:29 UTC](https://meta.discourse.org/t/example-plugin-for-new-upload-type/84377/1 "2018-04-02T12:29:38Z")

</div>

Are there any instructions or examples to look at for writing a plugin that allows users to upload a new type of file? Specifically, I’m hoping to write a plugin that lets users upload small-ish 3D files in obj/ply/vtk formats and add lightbox-like capabilities through vtk-js so they can be viewed inline.

---

<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: [2018年四月2日 16:54 UTC](https://meta.discourse.org/t/example-plugin-for-new-upload-type/84377/2 "2018-04-02T16:54:45Z")

</div>

Unless I’m missing something, there’s a site setting for that. Just add the file type there.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [2018年四月2日 16:57 UTC](https://meta.discourse.org/t/example-plugin-for-new-upload-type/84377/3 "2018-04-02T16:57:58Z")

</div>

I think it is the secondary part, which would simply requiring a markdown-it style plugin to interpret links with .obj/ply/vtk to make it show inline.

---

<div class="post-metadata">

### Author: ![vibraphone](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vibraphone/32/120233_2.png) [@vibraphone](https://meta.discourse.org/u/vibraphone)
#### Post date: [2018年四月2日 19:51 UTC](https://meta.discourse.org/t/example-plugin-for-new-upload-type/84377/4 "2018-04-02T19:51:22Z")

</div>

@pfaffman Thanks! I’ve been able to add the file types.

@cpradio Would following the example of your **[discourse-plugin-checklist](https://github.com/cpradio/discourse-plugin-checklist)** plugin (but replacing “a.attachment” elements with a vtk-js canvas instead of replacing “.chcklst-box” elements with clickable font-awesome icons) be what you had in mind? Searching for the markdown-it plugin was a little confusing… is markdown-it the name of a plugin or is it something that other extensions use? Thanks!

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [2018年四月2日 22:08 UTC](https://meta.discourse.org/t/example-plugin-for-new-upload-type/84377/5 "2018-04-02T22:08:14Z")

</div>

That could be a good start, there is a Gallery related plugin somewhere too that may be a good fit as well.
