SMARTUPLOAD and FTP combination

xiaoxiao2021-03-06  40

Before writing this program, you are thinking about buying a click JSP space to make a self-download site. But after watching the online quotation, JSP's space costs are much more expensive. I have to solve other ways to solve. Now use the FTP uploading method to solve these problems, you can upload resources to the specified server. This don't have to worry about the high space cost. <% @ page language = "java" import = "com.jspsmart.upload. *" Import = "java.text. *, java.util. *, java.io. *, org.apache.commons.net.ftp * "%> <% @ Page ContentType =" text / html; charset = GBK "%> < % I = 0; int size = 0; string filename = "" ", fileext =", suffix = "", name1 = ", newname =" ""; string ftphostname = String ftphone = "127.0.0.1"; // FTP host address string ftpuser = "ftp-username"; // username string ftppwd = "ftp-password"; // password string ftpdir = "/"; // ftp directory ftpclient ftp = New ftpclient (); mysmartupload.initialize (pagecontext); mysmartupload.upload (); com.jspsmart.upload.file myfile = mysmartupload.getfiles (). getFile (i);

If (! myfile.ismissing ()) {size = myfile.getsize (); filename = myfile.getFileName (); fileExt = myfile.getfileExt (); path = myfile.GetFilePathName (); suffix = filename.substring (0, Filename.lastIndexOf ('.')); If (size> = 300000) {out.print ("