├── jquery.client README.txt ├── README ├── LICENSE ├── utils.js ├── example.html ├── jquery.client.js ├── HOWTO └── jquery.dnd-file-upload.js /jquery.client README.txt: -------------------------------------------------------------------------------- 1 | the jquery.client plugin has been downloaded from http://www.stoimen.com/blog/2009/07/16/jquery-browser-and-os-detection-plugin/trackback/ -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | upload dropped file(s) from the filesystem into the browser via ajax to your server. this project uses the new drag and drop html5 api OR if not supported, the feature of some browsers (safari, chrome, chromium), to drop files onto the tag. 2 | 3 | currently the following browsers work with this plugin and hence a multiple file upload via drag and drop is possible with: 4 | 5 | * Firefox 3.6 6 | * Safari 4 7 | * Chrome 5 8 | * Chromium 4 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 Clemens Müller (cmueller.418@gmail.com) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /utils.js: -------------------------------------------------------------------------------- 1 | var base = 1024; 2 | 3 | function getReadableSpeedString(speedInKBytesPerSec) 4 | { 5 | var speed = speedInKBytesPerSec; 6 | speed = Math.round(speed * 10) / 10; 7 | if (speed < base) { 8 | return speed + "KB/s"; 9 | } 10 | 11 | speed /= base; 12 | speed = Math.round(speed * 10) / 10; 13 | if (speed < base) { 14 | return speed + "MB/s"; 15 | } 16 | 17 | return speedInBytesPerSec + "B/s"; 18 | } 19 | 20 | function getReadableFileSizeString(fileSizeInBytes) 21 | { 22 | var fileSize = fileSizeInBytes; 23 | if (fileSize < base) { 24 | return fileSize + "B"; 25 | } 26 | 27 | fileSize /= base; 28 | fileSize = Math.round(fileSize); 29 | if (fileSize < base) { 30 | return fileSize + "KB"; 31 | } 32 | 33 | fileSize /= base; 34 | fileSize = Math.round(fileSize * 10) / 10; 35 | if (fileSize < base) { 36 | return fileSize + "MB"; 37 | } 38 | 39 | return fileSizeInBytes + "B"; 40 | } 41 | 42 | function getReadableDurationString(duration) 43 | { 44 | var elapsed = duration; 45 | 46 | var minutes, seconds; 47 | 48 | seconds = Math.floor(elapsed / 1000); 49 | minutes = Math.floor((seconds / 60)); 50 | seconds = seconds - (minutes * 60); 51 | 52 | var str = ""; 53 | if (minutes>0) 54 | str += minutes + "m"; 55 | 56 | str += seconds + "s"; 57 | return str; 58 | } -------------------------------------------------------------------------------- /example.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 | 61 | 62 | 63 |