// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: SmartUpload.java
package com.jspsmart.upload;
import java.io.File;
import java.io.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
// Referenced classes of package com.jspsmart.upload:
// Files, Request, SmartUploadException, File
public class SmartUpload
{
protected byte m_binArray[];
protected HttpServletRequest m_request;
protected HttpServletResponse m_response;
protected ServletContext m_application;
private int m_totalBytes;
private int m_currentIndex;
private int m_startData;
private int m_endData;
private String m_boundary;
private long m_totalMaxFileSize;
private long m_maxFileSize;
private Vector m_deniedFilesList;
private Vector m_allowedFilesList;
private boolean m_denyPhysicalPath;
private boolean m_forcePhysicalPath;
private String m_contentDisposition;
public static final int SAVE_AUTO = 0;
public static final int SAVE_VIRTUAL = 1;
public static final int SAVE_PHYSICAL = 2;
private Files m_files;
private Request m_formRequest;
public SmartUpload()
{
m_totalBytes = 0;
m_currentIndex = 0;
m_startData = 0;
m_endData = 0;
m_boundary = new String();
m_totalMaxFileSize = 0L;
m_maxFileSize = 0L;
m_deniedFilesList = new Vector();
m_allowedFilesList = new Vector();
m_denyPhysicalPath = false;
m_forcePhysicalPath = false;
m_contentDisposition = new String();
m_files = new Files();
m_formRequest = new Request();
}
public final void init(ServletConfig servletconfig)
throws ServletException
{
m_application = servletconfig.getServletContext();
}
public void service(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
throws ServletException, IOException
{
m_request = httpservletrequest;
m_response = httpservletresponse;
}
public final void initialize(ServletConfig servletconfig, HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
throws ServletException
{
m_application = servletconfig.getServletContext();
m_request = httpservletrequest;
m_response = httpservletresponse;
}
public final void initialize(PageContext pagecontext)
throws ServletException
{
m_application = pagecontext.getServletContext();
m_request = (HttpServletRequest)pagecontext.getRequest();
m_response = (HttpServletResponse)pagecontext.getResponse();
}
public final void initialize(ServletContext servletcontext, HttpSession httpsession, HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse, JspWriter jspwriter)
throws ServletException
{
m_application = servletcontext;
m_request = httpservletrequest;
m_response = httpservletresponse;
}
public void upload()
throws ServletException, IOException, SmartUploadException
{
int i = 0;
boolean flag = false;
long l = 0L;
boolean flag1 = false;
String s = new String();
String s2 = new String();
String s4 = new String();
String s5 = new String();
String s6 = new String();
String s7 = new String();
String s8 = new String();
String s9 = new String();
String s10 = new String();
boolean flag2 = false;
m_totalBytes = m_request.getContentLength();
m_binArray = new byte[m_totalBytes];
int j;
for(; i < m_totalBytes; i += j)
try
{
m_request.getInputStream();
j = m_request.getInputStream().read(m_binArray, i, m_totalBytes - i);
}
catch(Exception exception)
{
throw new SmartUploadException("Unable to upload.");
}
for(; !flag1 && m_currentIndex < m_totalBytes; m_currentIndex++)
if(m_binArray[m_currentIndex] == 13)
flag1 = true;
else
m_boundary = m_boundary + (char)m_binArray[m_currentIndex];
if(m_currentIndex == 1)
return;
for(m_currentIndex++; m_currentIndex < m_totalBytes; m_currentIndex = m_currentIndex + 2)
{
String s1 = getDataHeader();
m_currentIndex = m_currentIndex + 2;
boolean flag3 = s1.indexOf("filename") > 0;
String s3 = getDataFieldValue(s1, "name");
if(flag3)
{
s6 = getDataFieldValue(s1, "filename");
s4 = getFileName(s6);
s5 = getFileExt(s4);
s7 = getContentType(s1);
s8 = getContentDisp(s1);
s9 = getTypeMIME(s7);
s10 = getSubTypeMIME(s7);
}
getDataSection();
if(flag3 && s4.length() > 0)
{
if(m_deniedFilesList.contains(s5))
throw new SecurityException("The extension of the file is denied to be uploaded (1015).");
if(!m_allowedFilesList.isEmpty() && !m_allowedFilesList.contains(s5))
throw new SecurityException("The extension of the file is not allowed to be uploaded (1010).");
if(m_maxFileSize > 0L && (long)((m_endData - m_startData) + 1) > m_maxFileSize)
throw new SecurityException("Size exceeded for this file : " + s4 + " (1105).");
l += (m_endData - m_startData) + 1;
if(m_totalMaxFileSize > 0L && l > m_totalMaxFileSize)
throw new SecurityException("Total File Size exceeded (1110).");
}
if(flag3)
{
com.jspsmart.upload.File file = new com.jspsmart.upload.File();
file.setParent(this);
file.setFieldName(s3);
file.setFileName(s4);
file.setFileExt(s5);
file.setFilePathName(s6);
file.setIsMissing(s6.length() == 0);
file.setContentType(s7);
file.setContentDisp(s8);
file.setTypeMIME(s9);
file.setSubTypeMIME(s10);
if(s7.indexOf("application/x-macbinary") > 0)
m_startData = m_startData + 128;
file.setSize((m_endData - m_startData) + 1);
file.setStartData(m_startData);
file.setEndData(m_endData);
m_files.addFile(file);
} else
{
String s11 = new String(m_binArray, m_startData, (m_endData - m_startData) + 1);
m_formRequest.putParameter(s3, s11);
}
if((char)m_binArray[m_currentIndex + 1] == '-')
break;
}
}
public int save(String s)
throws ServletException, IOException, SmartUploadException
{
return save(s, 0);
}
public int save(String s, int i)
throws ServletException, IOException, SmartUploadException
{
int j = 0;
if(s == null)
s = m_application.getRealPath("/");
if(s.indexOf("/") != -1)
{
if(s.charAt(s.length() - 1) != '/')
s = s + "/";
} else
if(s.charAt(s.length() - 1)
没有合适的资源?快使用搜索试试~ 我知道了~
带图片上传的文本编辑器源码
共282个文件
gif:186个
css:27个
htm:20个
4星 · 超过85%的资源 需积分: 9 164 下载量 187 浏览量
2008-09-26
13:37:35
上传
评论 1
收藏 703KB RAR 举报
温馨提示
本编辑器好用,可上传图片,源码修改简单,是本人在网上找了好久找到的,本工作室(金刚工作室)也一直在使用本编辑器!
资源推荐
资源详情
资源评论
收起资源包目录
带图片上传的文本编辑器源码 (282个子文件)
SmartUpload.class 16KB
File.class 6KB
EditWebhelper.class 6KB
EditBean.class 4KB
UploadWebHelper.class 3KB
TimeStamp.class 3KB
UploadBean.class 2KB
RemotePic.class 2KB
Request.class 2KB
Files.class 2KB
URLX.class 444B
SmartUploadException.class 386B
.classpath 408B
Editor.css 3KB
Editor.css 3KB
Editor.css 3KB
Editor.css 3KB
Editor.css 3KB
Editor.css 3KB
Editor.css 3KB
Editor.css 3KB
Editor.css 3KB
MenuArea.css 545B
MenuArea.css 545B
MenuArea.css 545B
MenuArea.css 545B
MenuArea.css 545B
MenuArea.css 545B
MenuArea.css 545B
MenuArea.css 545B
MenuArea.css 545B
EditorArea.css 165B
EditorArea.css 165B
EditorArea.css 165B
EditorArea.css 165B
EditorArea.css 165B
EditorArea.css 165B
EditorArea.css 165B
EditorArea.css 165B
EditorArea.css 165B
Thumbs.db 45KB
Thumbs.db 9KB
Thumbs.db 9KB
Thumbs.db 6KB
flower.gif 7KB
ivy.gif 6KB
ewebeditor.gif 5KB
christmas.gif 3KB
citrus.gif 2KB
46.gif 2KB
grid.gif 2KB
hearts.gif 1KB
35.gif 1KB
03.gif 1KB
25.gif 1KB
06.gif 1KB
14.gif 1KB
04.gif 1KB
12.gif 1KB
15.gif 1KB
11.gif 1KB
09.gif 1KB
10.gif 1KB
file.gif 1KB
01.gif 1KB
08.gif 1KB
02.gif 1KB
05.gif 1KB
07.gif 1KB
20.gif 1KB
13.gif 1KB
23.gif 1KB
50.gif 1KB
19.gif 1021B
26.gif 1016B
24.gif 1016B
27.gif 1014B
16.gif 998B
17.gif 998B
18.gif 985B
28.gif 981B
22.gif 976B
45.gif 964B
21.gif 960B
tech.gif 862B
48.gif 798B
37.gif 789B
49.gif 780B
modepreview.gif 773B
xls.gif 739B
modeedit.gif 733B
birthday.gif 726B
modeviewbtn.gif 717B
ppt.gif 712B
modecode.gif 705B
modeeditbtn.gif 678B
icq.gif 662B
qq.gif 657B
modecodebtn.gif 643B
msn.gif 642B
共 282 条
- 1
- 2
- 3
wwb__1001
- 粉丝: 4
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页