Use Jspsmartupload to upload and download files
Jspsmartupload components have 4 main classes: File class, files class, request class, and Smartupload class
The Initialize method of the *smartupload class: This method is to upload and download the common method, his role is to perform the upload and download initialization work, must first execute. There are several prototypes, mainly using the following:
Public final void Initialize (Javax.serlvet.jsp.PageContext pagecontext)
Where PageContext is a JSP page built-in object
I. Basic steps for File upload:
1. Create a new Smartupload object
Smartupload su = new Smartupload ();
2. Initialization
Su.initialize (PageContext);
3. Set various upload limits
Su.setmaxfilesize (XXX);
Su.settotalmaxfilesize (XXX);
4. Set the file extensions that are allowed to be uploaded, such as
Su.setallowedfileslist ("Doc,txt");
5. Set the Forbidden file extension (, which indicates a file with no extension), as
Su.setdeniedfileslist ("Exe,bat,,");
6. Uploading Files
Su.upload ();
7. Save the file to the specified directory xxx
Su.save (XXX);
8. Determine if there is an upload file
Com.jspsmart.upload.File File = Su.getfiles (). GetFile (0);
If!file.ismissing () () {
......
}