
Some parts of this message have been removed.
Learn more about Nabble's
security policy.
I'm using dojo (not really the problem) and the last DWR CVS version (compiled on jun-18-2009)
Basically, I connect the "onchange" events of an "<input type="file" >" and when the event is fired, I call a function that transfer the file to the server.
All works fine, (the callback function is executed)... but the input doesn't fire the 'onchange' event anymore.
The problem is common to Firefox, Chrome and IE.
I'm not really sure if this is an Issue or is the correct behaviour.
here you are an example of code:
HTML:
<input type="file" id="theFileInputId" />
JAVASCRIPT:
constructor:function() {
var fileInput = dojo.byId("theFileInputId");
dojo.connect(fileInput, "onchange",this, "_onUploadFileChange");
},
_onUploadFileChange: function(evt){
var input = evt.target;
console.debug("file for upload changed:" + input.value);
if(input.value) {
JVirtualDocumentSrv.addDocument(dwr.util.getValue(input), {
callback: function(data){console.debug("file uploaded:" + data.name);},
errorHandler: function(message) {console.debug("file upload failed:" + message);}
})
}
}
JAVA
public class JVirtualDocumentSrv {
public void addDocument( FileTransfer file ) throws Exception {
InputStream in = file.getInputStream();
try {
createFile(file.getName(), in);
} finally {
in.close();
}
}
...
Charlas más divertidas con el nuevo
Windows Live Messenger