JSP uses components to implement the full Raiders uploaded by the file

xiaoxiao2021-03-06  52

First, first download the jspsmartupload component

http://dboy520.51.net/cgi-bin/newjavajia/downcount.php?id=22 (this site address)

http://www.jspsmart.com

Second, copy the contents of the content in the directory jspsmartupload / wiB_inf / classes to the web-inflight in the actual directory where the site is located (RESIN is this directory, the other may be Classes, please check the jspsmartupload / help / setup.htm)

Third, if it is RESIN, please run the JSP, please in the conf / resin.conf of resin.

and Add:

Fourth, the code of the upload interface is as follows: (file name: insert.htm)





Subject:

Note the above real-path directory

5. The code for UPLOADFILE.JSP is as follows:

<% @ Page ContentType = "text / html; charset = GB2312"

Language = "java"

IMPORT = "com.jspsmart.upload. *"%>

Scope = "Page"

Class = "com.jspsmart.upload.smartupload" />

file upload JSP


<%

INT count = 0;

/ / Define the target directory

String destination = "/ upload /";

MySmartupload.initialize (PageContext);

//File Upload

mysmartupload.upload ();

// Get the content of the text

String content = mysmartupload.getRequest (). GetParameter ("text1"); // Display text content

Out.println (Content);

// Upload statistics

For (int i = 0; i

com.jspsmart.upload.file myfile = mysmartupload.getfiles (). getfile (i);

IF (! myfile.ismissing ()) {

MyFile.saveas (Destination MyFile.GetFileName ());

Out.println ("file name =" myfile.getfieldname () "
");

Out.println ("file size =" myfile.getsize () "
");

Out.println ("file name =" myfile.getfilename () "
");

Out.println ("file size =" myfile.getfileExt () "
");

Out.println ("file path name =" myfile.getfilepathname () "
");

Out.println ("File Type =" MyFile.getContentType () "
");

Out.println ("ContentDisp =" myfile.getContentDisp () "
");

Out.println ("MIME Type =" MyFile.gettypemime () "
");

Out.println ("Subtypemime =" myfile.getsubtypemime () "
");

COUNT ;

}

}

Out.println ("
can upload" mysmartupload.getfiles (). getCount () "File
");

Out.println (Count "file has been uploaded");

%>

The above is the whole process uploaded by the JSP file, Good luck!

Welcome to reprint in the case of retaining http://www.javajia.com!

转载请注明原文地址:https://www.9cbs.com/read-118010.html

New Post(0)