jsp°ÑͼƬдµ½Êý¾Ý¿âµÄ´úÂë,¶àÖÖд·¨
ÓÉÓÚÒª×öÉÏ´« ¾ÍÕÒÁ˸öÀý×Ó Áô×Ųο¼
ÉÏ´«£ºÐèÒªsmartupload×é¼þ
import com.jspsmart.upload.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
/**
* ÉÏ´«¹«¹²Àà,¶ÔSmartUpload½øÐÐÁË·â×°
* @author askr
* @version 1.0
*/
public class MyUpload
{
/**
*±£´æÉÏ´«µÄÎļþ
*
* @param request Ò³ÃæÇëÇó¶ÔÏó
* @param response Ò³ÃæÏìÓ¦¶ÔÏó
* @param config Ò³ÃæÅäÖöÔÏó
* @param mainName ¸³ÓèµÄÖ÷ÎļþÃû
* @param savePhyPath Îļþ±£´æµÄÎļþ¼Ð
* @param maxSizePool ÉÏ´«Ê±ÔÊÐíµÄ×î´óÈÝÁ¿£¬µ¥Î»£ºKB
* @param maxSizeAllowed ÎļþÉÏ´«Ê±ÔÊÐíµÄ×î´ó´óС£¬µ¥Î»£ºKB
* @param formatListAllowed ÔÊÐíµÄÎļþ¸ñʽ£¬ÒÔ¶ººÅ·Ö¸ôµÄ×Ö·û´®ÐòÁÐ
* @return Èç¹ûûÓÐÉÏ´«£¬·µ»Ø¿Õ×Ö·û´®£¬·ñÔò£¬ÊDZ£´æºóµÄÎļþÃû
*/
public static String SaveUpload(HttpServletRequest request,
HttpServletResponse response,ServletConfig config,
String mainName,String savePhyPath,int maxSizePool,int maxSizeAllowed,
String formatListAllowed)
{
SmartUpload upl = new SmartUpload();
com.jspsmart.upload.File f=null;
try {
upl.init(config); //configÊÇÒþº¬ÄÚÖöÔÏó
upl.service(request, response);
// upl.setAllowedFilesList(formatListAllowed);
upl.setTotalMaxFileSize(maxSizePool * 1024); //×Ö½Ú
upl.upload();
f = upl.getFiles().getFile(0);
String name = f.getFileName();
if (f.getSize() == 0) {
return "";
}
if (f.
Ïà¹ØÎĵµ£º
Excel±¨±íµÄ·½·¨£¬Ò»¸ö¹ýì¶¼òµ¥£¬Ò»¸öÖ»ÄÜÓÃì¶windowƽ̨(ÒòΪʹÓÃjdbc-odbc bridge)£¬ÇÒÎÞ·¨Ê¹Óõ½ExcelÄÚ²¿µÄ¸÷ÖÖ¹«Ê½»òÊÇ·½·¨£¬Òò´Ë£¬½ñÌì½éÉÜÒ»¸öapache³öµÄÔª¼þ½ÐPOI£¬Ëü¿ÉÒÔÔÚUNIX»òwindowƽ̨´¦Àíword»òExcelµµ°¸£¬¶ø²»ÐèÒªÒÀ¿¿windowµÄcom£¬²¢ÇÒ¿ÉÉ趨´¢´æ¸ñ¸ñʽ¡¢ÁÐÓ¡¸ñʽµÈµÈ£»½ñÌìÎÒÀ´½éÉÜÆäÖÐÓйØ×ÊÁ϶ÁÈ¡¡¢ÐÂÔ ......
×î»ù±¾µÄÂÒÂëÎÊÌâ
Õâ¸öÂÒÂëÎÊÌâÊÇ×î¼òµ¥µÄÂÒÂëÎÊÌâ¡£Ò»°ãлá³öÏÖ¡£¾ÍÊÇÒ³Ãæ±àÂë²»Ò»Öµ¼ÖµÄÂÒÂë¡£
Html´úÂ룺
£¼%@ page language="java" pageEncoding="UTF-8"%£¾
£¼%@ page contentType="text/html;charset=iso8859-1"%£¾
£¼html£¾
£¼head£¾
£¼title ......
1.request¶ÔÏó
¸Ã¶ÔÏó·â×°ÁËÓû§Ìá½»µÄÐÅÏ¢£¬Í¨¹ýµ÷ÓøöÔÏóµÄÏìÓ¦µÄ·½·¨¿ÉÒÔ»ñÈ¡Óû§Ìá½»µÄÐÅÏ¢¡£
µ±request¶ÔÏó»ñÈ¡Óû§Ìá½»µÄºº×Ö×Ö·ûʱ£¬»á²úÉúÂÒÂ룬ÓÉÏÂÃæµÄ·½·¨¿ÉÒÔ½â¾ö£º
Sting s2 = new String(s1.getBytes("iso8859-1"),"GB2312")½øÐÐת»»¡£
request³£Óõķ½·¨ ......
1.FCKeditor ½éÉÜ
FCKeditor Õâ¸ö¿ªÔ´µÄHTML Îı¾±à¼Æ÷¿ÉÒÔÈÃweb ³ÌÐòÓµÓÐÈçMS Word ÕâÑùÇ¿´óµÄ±à¼¹¦ÄÜ£¬.FCKeditor Ö§³Öµ±Ç°Á÷ÐеÄä¯ÀÀÆ÷¡£
2£®×¼±¸¹¤×÷£º
»·¾³£ºwinddows XP¡¢tomcat6.0¡¢JDK1.6
ÏÂÔØ£º
1)£ºFCKeditor_2.6.4.zip
µØÖ·£ºhttp://nchc.dl.sourceforge.net/sourceforge/fckeditor/FCKeditor_2.6.4.zip ......
µÚÒ»ÖÖ£º
<script language="javascript" type="text/javascript">
window.location.href="login.jsp?backurl="+window.location.href;
</script>
µÚ¶þÖÖ£º
<script language="javascript">
alert("·µ»Ø");
window.history.back ......