View Full Version : How to drop an file from desktop to Ext.Panel
stephan.raabe
15 Jan 2009, 8:03 AM
Hello,
is it possible to drop an element/file from destop to an Ext.Panel?
That doesn't work:
var uploadPanel = new Ext.Panel({
region:'south',
title:'Upload',
height:400
});
uploadPanel.on("drop",function(e){
alert("ok");
}); Stephan
stephan.raabe
16 Jan 2009, 3:20 AM
Hello,
currently I've got the following solution for a component:
var uploadPanel = new Ext.BoxComponent({
region:'south',
title:'Upload',
height:84,
autoEl:{tag: 'div', html: '<div style="padding:10px;"><img src="images/download.png" style="float:left;padding-right:10px;"/> Move files to transfer to the server.</div>'},
listeners: {
render: function(c){
cmpid = c.getId();
target = document.getElementById(cmpid);
target.addEventListener("dragover", function(event){
event.preventDefault();
});
target.addEventListener("drop", function(event){
fileArr = event.dataTransfer.getData("application/x-vnd.adobe.air.file-list");
for (y = 0; y < fileArr.length; y++) {
alert(fileArr[y].nativePath);
}
});
}
}
});
Now I start to transfer the files to the server.
Any comments?
Stephan
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.