All Projects → GoogleChromeLabs → File Drop

GoogleChromeLabs / File Drop

Licence: apache-2.0
A simple file drag and drop custom-element

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to File Drop

vue3-dropzone
HTML5 drag-drop zone with vue3
Stars: ✭ 34 (-81.91%)
Mutual labels:  drag-and-drop, file-upload
Dropzone
Dropzone is an easy to use drag'n'drop library. It supports image previews and shows nice progress bars.
Stars: ✭ 16,097 (+8462.23%)
Mutual labels:  drag-and-drop, file-upload
yii2-dropzone
This extension provides the Dropzone integration for the Yii2 framework.
Stars: ✭ 11 (-94.15%)
Mutual labels:  drag-and-drop, file-upload
react-butterfiles
🦋 Component for building file fields - from basic file inputs to drag and drop image galleries.
Stars: ✭ 44 (-76.6%)
Mutual labels:  drag-and-drop, file-upload
Angular File Uploader
Angular file uploader is an Angular 2/4/5/6/7/8/9/10 + file uploader module with Real-Time Progress Bar, Responsive design, Angular Universal Compatibility, localization and multiple themes which includes Drag and Drop and much more.
Stars: ✭ 92 (-51.06%)
Mutual labels:  drag-and-drop, file-upload
vue-simple-upload-component
A simple upload component for Vue.js 2.x
Stars: ✭ 14 (-92.55%)
Mutual labels:  drag-and-drop, file-upload
image-uploader
Simple Drag & Drop image uploader plugin to static forms, without using AJAX
Stars: ✭ 70 (-62.77%)
Mutual labels:  drag-and-drop, file-upload
React Uploady
Modern file uploading - components & hooks for React
Stars: ✭ 372 (+97.87%)
Mutual labels:  drag-and-drop, file-upload
React Dropzone
Simple HTML5 drag-drop zone with React.js.
Stars: ✭ 8,639 (+4495.21%)
Mutual labels:  drag-and-drop, file-upload
Filepond Boilerplate Php
🔥 A FilePond PHP project starter kit
Stars: ✭ 45 (-76.06%)
Mutual labels:  drag-and-drop, file-upload
Filepond
🌊 A flexible and fun JavaScript file upload library
Stars: ✭ 11,869 (+6213.3%)
Mutual labels:  drag-and-drop, file-upload
React File Drop
React component for Gmail or Facebook -like drag and drop file uploader
Stars: ✭ 123 (-34.57%)
Mutual labels:  drag-and-drop, file-upload
Ipfs Dropzone
Dropzone.js that uploads to IPFS instead of to an URL
Stars: ✭ 151 (-19.68%)
Mutual labels:  drag-and-drop, file-upload
Draggable
High performance, fully cross browser, full featured drag and drop in a tiny (2k gzipped), dependency-free package
Stars: ✭ 160 (-14.89%)
Mutual labels:  drag-and-drop
Sharry
Sharry is a self-hosted file sharing web application.
Stars: ✭ 170 (-9.57%)
Mutual labels:  file-upload
Ngx Dynamic Dashboard Framework
This is a JSON driven angular x based dashboard framework that is inspired by JIRA's dashboard implementation and https://github.com/raulgomis/angular-dashboard-framework
Stars: ✭ 160 (-14.89%)
Mutual labels:  drag-and-drop
React Firebase File Uploader
An image uploader for react that uploads images to your firebase storage
Stars: ✭ 155 (-17.55%)
Mutual labels:  file-upload
Sharex Upload Server
AKA ShareS - Feature full & Stable ShareX and file server in node. Includes images, videos, code, text, markdown rendering, password protected uploads, logging via discord, administration through Discord, url shortening, and a full front end. Use standalone or via reverse proxy
Stars: ✭ 180 (-4.26%)
Mutual labels:  file-upload
Phpagebuilder
A drag and drop page builder to manage pages in any PHP project.
Stars: ✭ 168 (-10.64%)
Mutual labels:  drag-and-drop
Lxreorderablecollectionviewflowlayout
Extends `UICollectionViewFlowLayout` to support reordering of cells. Similar to long press and pan on books in iBook.
Stars: ✭ 1,831 (+873.94%)
Mutual labels:  drag-and-drop

file-drop Custom Element

The file drop custom element is a simple Custom Element that accepts File objects being dropped on it and fires a dedicated event onfiledrop when a successful drop occurs.

Installation

npm i file-drop-element

Demo

You can try a quick demo of this element on glitch.

Usage

Directly as a module

Copy from node_modules in to a local directory.

<script src='file-drop.mjs' type='module'></script>

<file-drop>

  Drop file here

</file-drop>

Directly as a UMD, for non-ES6 Module supporting browsers

<script src='file-drop.umd.js'></script>

<file-drop>

  Drop file here

</file-drop>

Respond to when a file is dropped on the element

When a user has succesfully dropped a file on to the element, the element will emit a filedrop event. The filedrop event contains a file property which is a direct reference to the File that was dropped.

<file-drop id="dropTarget">Drop a file here</file-drop>

<script>
dropTarget.addEventListener('filedrop', (e) => {
  dropTarget.textContent = e.file.name;
});
</script>

Note: if more than one file is dropped on the element, only the first file will be included on the event.

Only allow certain files to be dropped on the element.

The element will accept any drop event that has the .dataTransfer object populated with any file. If you want to control the types of files that can be dropped on to the element, use the same syntax that <input> elements use when the accept attribute is set, that is:

  • <file-drop> - any file
  • <file-drop accept='image/*'> - all images
  • <file-drop accept='image/png'> - only Images that have the MIME-type of a PNG.

Allow multiple files to be dropped

The element can accept multiple files being dropped or pasted on to the element. By default the element will only accept return the first file if the user drops multiple files on it. If you want to receive multiple files in the event you can add the multiple attribute to the element.

<file-drop multiple>

  Drop file here

</file-drop>

If you add an accept attribute alongside the multiple element, the onfiledrop event will only trigger if there is at least one file that matches the criteria. It will return a filtered list of files where each file will match the value in the accept attribute.

<file-drop multiple accept='image/*'>

  Drop file here

</file-drop>

Styling

The element is an inline display element and it can be controlled like any normal element. The element does not use Shadow DOM so there are no internal elements to style.

The element will add two classes drop-valid and drop-invalid to the element depending on the mime-type of the file that is currently being dragged over the element.

<style>

file-drop.drop-valid {
  background-color: green;
}

file-drop.drop-invalid {
  background-color: red;
}

</style>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].