Hey! This name is really difficult, it looks whims, huh, huh. . . Don't say nonsense, let's talk about it! I am doing a project! There are too many abnormalities now, using Java seems to show an incomparable ability. It is an idiot that is like Microsoft. It doesn't actually use anything. It's so poor, the problem has appeared, one is more difficult to solve, and finally finally encountered, the most difficult problem is the upload and download of the file. Hey! If Microsoft's Dongdong, what else is there, it is not easy! But this dead java is good, it is not easy, there is no way, I used it for three days before I got him, 3 sleepless nights! Used two free Java packs, I should be able to get it, who knows, it is difficult! These packages are old and outdoor, why Chinese people can't write, hehe! It's no wonder, who told the Chinese smart! Use it to get it, hehe. . . Anyway, don't save money. I finally decided to use, the file upload use: http://www.javazoom.net UPLOADBEAN JAVA package, his file is not bad, can be uploaded by the directory or database file, the default is Oracle's longraw The subsection type can use the blob type, but you need to use the extended Java package, the maximum length of the longraw subsection is 2GB, and a longraw subsection is only allowed in a table, but it is already used, and the BLOB type subsection is the largest Take 4GB, and there is no limit to the number of times in the table. Remarks: I want to use the components of him download4j 1.0, I advised still not to dream, and it is not suitable for downloading in the database. File download is: http://www.jspsmart.com's Smartupload Java package, you can upload file, you can also file it, and it is more convenient, but I am here only using files from database download function. If you are interested, you can try it. Below I put the source code of these two packages to everyone, I will not be like me as I am in the future, hehe! How great people! Everyone gives the applause to comfort my injured lonely man! Upload: In fact, these Java packs have an example, but I still have to post it.
File Name: chinesDatabaseUpload.jsp file content: <% @ page language = "java" contenttype = "text / html; charSet = GB2312" Import = "javazoom.upload. *, Java.util. *"%> <%> <% request.setCharacterEncoding ( "gb2312");. if (MultipartFormDataRequest.isMultipartFormData (request)) {// Uses MultipartFormDataRequest to parse the HTTP request MultipartFormDataRequest mrequest = new MultipartFormDataRequest (request, null, 100 * 1024 * 1024, MultipartFormDataRe Quest.cosparser, "GB2312"); string Todo = MREQUEST.GETPARAMETER ("TODO"); if ((TODO! = null) && (TODO.EQUALSINORECASE ("UPLOAD")))) {HashTable Files = MREQUEST.GETFILES () ; if ((files! = null) | (! files.isempty ())) {UPLOADFILE FILE = (UPLOADFILE) FILES.GET ("UPLOADFILE"); OUT.PRINTLN ("
"
UPLOADED FILE (Uploaded file name):" file.getfilename () "(" file.getfilesis () "bytes)" "
Content Type" file .getContentType ()); //out.println ("
Content Type " file.getContentType (); // Uses the bean now to store specified by jsp: setProperty at the top. UpBean.Store (MREQUEST," UPLOADFILE ");} else {OUT. Println ("
GB2312 TEXT (Simplified) =" MRequest.getParameter ("GB2312TXT");} else out.println ("
Todo = " TODO);}%> font> ul>