mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-30 03:29:14 -04:00
first full roundtrip
This commit is contained in:
parent
dd4809f519
commit
dc1af5ae7b
19 changed files with 222 additions and 450 deletions
25
app/elements/file-sharing/file-selection-behavior.html
Normal file
25
app/elements/file-sharing/file-selection-behavior.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
<script>
|
||||
'use strict';
|
||||
window.Chat = window.Chat || {};
|
||||
Chat.FileSelectionBehavior = {
|
||||
notifyFilesSelection: function(files) {
|
||||
if(!files){
|
||||
console.log('no files selected...');
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var file = files[i];
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e2) {
|
||||
// finished reading file data.
|
||||
console.log('file dropped');
|
||||
this.fire('file-selected', {
|
||||
dataURI: e2.target.result,
|
||||
name: file.name
|
||||
});
|
||||
}.bind(this);
|
||||
reader.readAsDataURL(file); // start reading the file data.
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue