Upload file upload, download with Java to implement Oracle Database

zhaozj2021-02-16  54

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. *"%> <%> < % @ Page ErrorPage = "ExceptionHandler.jsp"%> Chinese upload </ title> <meta http-equiv =" content-type "content =" text / html; charset = "GB2312"> </ head> <body bgcolor = "# fffff" text = "# 000000"> <ul> <font size = "- 1" face = "Verdana, Arial, Helvetica, Sans-Serif"> <% 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 ("<li> Form Field" : UploadFile " </p> <p>"<br> UPLOADED FILE (Uploaded file name):" file.getfilename () "(" file.getfilesis () "bytes)" "<br> Content Type" file .getContentType ()); //out.println ("<Lian " " <br> Uploaded File: " file.getfilename () " (" file.getfilesis () " bytes) " " <br> Content Type " file.getContentType (); // Uses the bean now to store specified by jsp: setProperty at the top. UpBean.Store (MREQUEST," UPLOADFILE ");} else {OUT. Println ("<li> no uploaded files");} out.println ("<br> GB2312 TEXT (Simplified) =" MRequest.getParameter ("GB2312TXT");} else out.println ("<br> Todo = " TODO);}%> </ font> </ ul> <form method =" post "action =" chineseDatabaseupload.jsp "name =" upform "enctype =" multipart / form-data "> <Table Width = "60%" border = "0" cellspacing = "1" cellpadding = "1" align = "center"> <tr> <td align = "left"> <font size = "- 1" face = "Verdana, Arial , Helvetica, Sans-Serif> <b> Please select the upload file: </ b> </ font> <td> </ tr> <tr> <td align = "left"> <font size = "- 1 "face =" Verdana, Arial, Helvetica, Sans-Serif "> <Input type =" file "name =" uploadfile "size =" 50 "> </ font> </ td> <tr> <tr> <td align =" left "> <font size =" - 1 "Face =</p> <p>"Verdana, Arial, Helvetica, Sans-Serif"> GB2312 TEXT: <input type = "text" name = "GB2312TXT" size = "20"> </ font> </ td> </ tr> <TR> <TD Align = "Left"> <font size = "- 1" face = "verdana, arial, helvetica, sans-serif"> <input type = "hidden" name = "todo" value = "Upload"> <input type = "Submit" name = "submit" value = "Upload"> <input type = "reset" name = "reset" value = "cancel"> </ font> </ td> </ tr> </ table> <br > <br> <table width = "90%" border = "0" cellspacing = "1" cellpadding = "0" align = "center"> <tr> <td bgcolor = "# 666666"> <table width = " 100% "border =" 0 "cellspacing =" 1 "cellpadding =" 0 "align =" center "> <tr> <TD bgcolor =" # ffffff "> <font size =" - 1 "face =" Verdana, Arial , Helvetica, Sans-Serif> <b> <font color = "# 0000ff"> Needed HTML Tags: </ font> </ b> </ font> <td> </ tr> <tr> <td bgcolor = "# Ffffff"> <font size = "- 1" face = "Verdana, Arial, Helvetica, Sans-Serif"> << B> Form </ b> <B> Method </ b> = "<b> <font color =" # ff0000 "> post </ font> </ b>"</p> <p><B> Action </ b> = "<font color =" # ff0000 "> ChineseUpload.jsp </ font> </ b>" name = "Upload" <b> ENCTYPE </ B> = "< B> <font color = "# ff0000"> Multipart / form-data </ ​​font> </ b>> </ font> <td> </ tr> <tr> <td bgcolor = "# ffffff"> <font size = "- 1" face = "Verdana, Arial, Helvetica, Sans-Serif"> << B> Input </ b> <b> type </ b> = "<b> <font color =" # FF0000 "> File </ font> </ b> <b> name </ b> =" <font color = "# ff0000> <b> UploadFile </ b> </ font>" size = "50" > </ font> </ td> </ tr> </ table> </ td> </ tr> </ table> <p> </ p> <p> </ p> <p align = "center" > </ P> <p align = "center"> </ p> <p align = "center"> </ p> <p align = "center"> </ p> </ form> </ body> < / html> The oracle table structure is looking for it on the site! It is very simple to do three sub-sections. File Download: File Name: JSPSmartDownload.JSP File Content: <meta http-equiv = "Content-Type" Content = "Application / Msword; Charset = GB2312"> // Note Here, if you are not set to "GB2312" Will understand.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-24180.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="24180" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.046</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'oEFgvFnm0r9fbkTfbgWJKMxF4_2BNx8NGji3Nl3RR47zfJkPdaM7S4_2F_2FuiO5O_2BqTo1FFWqh5TbWVHdwakI'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>