Believe that many projects, often file upload function bar.
Can I upload a file with Dwr? Simplifies the file upload process.
The answer, of course, is "certainly achievable".
The file upload function with DWR requires more than 3.0 versions.
OK, let's take a look at some basic things about file uploads.
1.html:
<input type= "File" name= "file"/>
2.js
var files = dwr.util.getValue ("file");//This is the method in the Util.js file provided by the DWR package
uploadbean.uploadfile (Files, function (ret) {
//do Something
});
3.java
public class Uploadbean{Public
boolean uploadfile (InputStream fileStream) {//This stream is the file stream
//do other something;
return true;
}
}
Good use of dwr3.0 upload files, roughly the above several comments on the place, is not very convenient AH.
Note: The code is I manually knocked up, if there are errors in the place, please correct, thank you.