# How to limit no of files to 1 when drag and drop files

**URL:** <https://community.transloadit.com/t/how-to-limit-no-of-files-to-1-when-drag-and-drop-files/15559>\
**Category:** Uppy\
**Created:** [January 16, 2021, 9:14pm UTC](https://community.transloadit.com/t/how-to-limit-no-of-files-to-1-when-drag-and-drop-files/15559 "2021-01-16T21:14:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![harshajayaweeraXHJ](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.transloadit.com/harshajayaweeraxhj/32/343_2.png) [@harshajayaweeraXHJ](https://community.transloadit.com/u/harshajayaweeraXHJ)\
**Post date:** [January 16, 2021, 9:14pm UTC](https://community.transloadit.com/t/how-to-limit-no-of-files-to-1-when-drag-and-drop-files/15559/1 "2021-01-16T21:14:35Z")

</div>

How to limit no of files to 1 when drag and drop files. I need to user to be able to only upload single files. this can be done for click-and-upload but doesn’t work in the drag and drop mode

---

<div class="post-metadata">

**Author:** ![ajkachnic](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.transloadit.com/ajkachnic/32/260_2.png) [@ajkachnic](https://community.transloadit.com/u/ajkachnic)\
**Post date:** [February 7, 2021, 12:22am UTC](https://community.transloadit.com/t/how-to-limit-no-of-files-to-1-when-drag-and-drop-files/15559/2 "2021-02-07T00:22:33Z")

</div>

Unless there’s a bug in the `@uppy/drag-drop` plugin preventing this from working, this should be available using the `restrictions.maxNumberOfFiles` option when initializing Uppy. Here’s some example code:

```auto
// On initialization
const uppy = new Uppy({
  restrictions: {
    maxNumberOfFiles: 1
  }
})

// Later on
uppy.setOptions({
  restrictions: {
    maxNumberOfFiles: 1
  }
})

```

Let me know if this works,  
- Andrew
