{"id":19358873,"url":"https://github.com/kathan/drop-upload","last_synced_at":"2025-10-27T00:35:04.415Z","repository":{"id":95303419,"uuid":"43715848","full_name":"kathan/drop-upload","owner":"kathan","description":"A handler to receive drag-and-drop files, upload the files and monitor the progress those Files.","archived":false,"fork":false,"pushed_at":"2021-02-18T19:37:55.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-06T18:42:14.771Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kathan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-05T21:52:08.000Z","updated_at":"2021-02-18T19:37:57.000Z","dependencies_parsed_at":"2023-07-16T17:02:14.261Z","dependency_job_id":null,"html_url":"https://github.com/kathan/drop-upload","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kathan%2Fdrop-upload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kathan%2Fdrop-upload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kathan%2Fdrop-upload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kathan%2Fdrop-upload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kathan","download_url":"https://codeload.github.com/kathan/drop-upload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240475230,"owners_count":19807292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T07:13:24.069Z","updated_at":"2025-10-27T00:35:04.325Z","avatar_url":"https://github.com/kathan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# drop-upload\nA dependency free library to receive drag-and-drop files, upload the files and monitor the progress those Files.\n\n## Usage\n### HTML\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003cscript src=\"../drop-upload.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"DUCtrl.js\"\u003e\u003c/script\u003e\n    \u003cstyle\u003e\n    body{\n      font-family: sans-serif;\n    }\n    #files{\n      list-style: none;\n    }\n    \n    .du{\n      vertical-align:middle;\n      line-height: 100px;\n      text-align: center;\n      width: 350px;\n      height: 100px;\n      color: grey;\n      border: 1px dotted grey;\n    }\n    \n    .my-class{\n      color: black !important;\n      border: 3px solid black !important;\n    }\n    \n    .progress-frame{\n      background-color: #dbdbdb;\n      width: 200px;\n      border-radius: 3px;\n      border: 1px solid #c0c0c0;\n      overflow: hidden;\n    }\n    \n    \u003c/style\u003e\n  \u003c/head\u003e\n  \u003cbody ng-app=\"DUApp\" ng-controller=\"DUCtrl\"\u003e\n    \u003cdiv id=\"debug\"\u003e\u003c/div\u003e\n    \u003cdiv id=\"du\" class=\"du\"\u003e\n      \u003cspan\u003eDrop files here\u003c/span\u003e\n    \u003c/div\u003e\n    \u003cbutton ng-click=\"upload()\"\u003eUpload\u003c/button\u003e\n    \u003cul id=\"files\" ng-repeat=\"file in files\"\u003e\n      \u003cli\u003e\n        {{file.name}}\n        \u003cdiv class=\"progress-frame\"\u003e\n          \u003cdiv ng-style=\"{'border-top': '1px solid #3886d8', 'border-bottom': '1px solid #3886d8','border-radius':'5px','background-color':'419bf9','height':'3px','width': file.progress*2}\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n      \u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n### Javascript (Using Angular)\n```javascript\nvar DUApp = angular.module(\"DUApp\",[]);\n\nDUApp.controller('DUCtrl', function ($scope, $http, $rootScope){\n  var du = DropUpload({targetElement: '#du', hoverClass: 'my-class'});\n  \n  $scope.upload = function(){\n    /*************************************************\n     * Change the value of my_url to set it in action\n     *************************************************/\n     var my_url = 'http://your-server.url/that/receives/uploads'\n    du.upload(my_url, function(e) {\n      var i = 0;\n    });\n  }\n  \n  du.addEventListener('files-dropped', function(e) {\n    /************************************************\n     * e.detail contains an array of the files that were dropped.\n     *************************************************/\n    $scope.files = e.detail;\n    $scope.$apply();\n  });\n  \n  du.addEventListener('progress', function(e) {\n    /*************************************************\n     * Each file has a progress property that is updated,\n     * which is being used in the Angular template to set \n     * the width of the progress bar.\n     * Since the list of files is in $scope.files,\n     * all that needs to be done is to call $scope.$apply.\n     **************************************************/\n    $scope.$apply();\n  });\n  \n  du.addEventListener('error', function(e) {\n    $('#debug').text('Some bad stuff happened');\n  });\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkathan%2Fdrop-upload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkathan%2Fdrop-upload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkathan%2Fdrop-upload/lists"}