这个问题拖了3天了,高手出脚相助吧
我用了smartUpload这个模块
现在发现小于1k的文件不能下载.怎么回事
如果是设置问题请说明如何设置,反正不管什么解决方法,希望详细说明.不要留几个不痛不痒的字就走人
谁帮我解答了另送50分
问题点数:0、回复次数:10Top
1 楼windinn(颠覆后25时代)回复于 2005-02-01 15:13:28 得分 0
顶一下了,看来高人都在想着怎么过年了Top
2 楼SInoyew(天行杨)回复于 2005-02-01 15:17:11 得分 0
问题我也没见过,只能帮你顶喽。
思考!Top
3 楼windinn(颠覆后25时代)回复于 2005-02-01 15:31:21 得分 0
来人啊,Top
4 楼windinn(颠覆后25时代)回复于 2005-02-01 15:59:51 得分 0
救命啊Top
5 楼windinn(颠覆后25时代)回复于 2005-02-01 16:13:04 得分 0
aiTop
6 楼bwsabc(javavaj)回复于 2005-02-01 16:28:22 得分 0
拖了两天还不如自己看源码自己搞定.Top
7 楼windinn(颠覆后25时代)回复于 2005-02-01 16:59:09 得分 0
这个模块没有源码吧,谁有,给一个Top
8 楼bwsabc(javavaj)回复于 2005-02-01 17:13:46 得分 0
用jad反编译.Top
9 楼kiki0712(乖的无聊)回复于 2005-02-01 18:12:55 得分 0
送上针对smartupload写的工具类,供你参考。
package new.com.website.util;
import com.jspsmart.upload.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import new.com.website.vo.voConfig;
import new.com.website.bean.systemmanage.configManage.web_Config;
//上传文件。
public class UploadUtil {
private long maxSize;//最大字节数(B)
private String path;//存储路径(绝对路径,包括主文件名,不包括括展名)
private String format;//文件格式
private PageContext pageContext;
private com.jspsmart.upload.SmartUpload smartUpload;
private String primaryFileName;//主文件名
private String fileName;
private String relativePath;//相对路径
private String pathAndFileName;
public UploadUtil()
{
this.smartUpload=new com.jspsmart.upload.SmartUpload();
}
public UploadUtil(PageContext pageContext)
{
this.smartUpload=new com.jspsmart.upload.SmartUpload();
this.pageContext=pageContext;
}
public UploadUtil(long maxSize,String path,String format,PageContext pageContext)
{
this.maxSize=maxSize;
this.path=path;
this.format=format;
this.pageContext=pageContext;
this.smartUpload=new com.jspsmart.upload.SmartUpload();
}
public void setPrimaryFileName(String str)
{ this.primaryFileName=str;}
public String getPrimaryFileName()
{ return this.primaryFileName;}
public void setMaxSize(long n)
{ this.maxSize=n*1024;}
public long getMaxSize()
{ return this.maxSize;}
public void setPath(String str)
{ this.path=str;}
public String getPath()
{ return this.path;}
public void setFormat(String str)
{ this.format=str;}
public String getFormat()
{ return this.format;}
public void setPageContext(PageContext obj)
{ this.pageContext=obj;}
public String getFileName()
{ return this.fileName;}
public void setRelativePath(String str)
{ this.relativePath=str;}
public String getRelativePath()
{ return this.relativePath;}
public Request getRequest()
{ return this.smartUpload.getRequest();}
public String getAbsolutePathAndFileName()
{
return this.pathAndFileName;
}
public String getRelativePathAndFileName()
{
return this.relativePath.trim()+this.fileName;
}
public boolean upload()
{
boolean result=false;
try
{
smartUpload.initialize(pageContext);
smartUpload.setMaxFileSize(this.maxSize);
smartUpload.setAllowedFilesList(this.format);
smartUpload.upload();
com.jspsmart.upload.File file=smartUpload.getFiles().getFile(0);
if(file.getSize()>this.maxSize)
throw new Exception("文件太大。");
if(file.getSize()==0&&file.getFileExt().equals(""))
{
throw new Exception("上传失败!");
}
file.saveAs(this.path+"."+file.getFileExt().toLowerCase());
this.fileName=new java.io.File(this.path+"."+file.getFileExt().toLowerCase()).getName();
this.pathAndFileName=new java.io.File(this.path+"."+file.getFileExt().toLowerCase()).getPath();
result=true;
}
catch(Exception e)
{
result=false;
e.printStackTrace();
}
return result;
}
public boolean defaultUpload(String str)
{
if(str.charAt(str.length()-1)!='\\'||str.charAt(str.length()-1)!='/')
str=str+"\\";
voConfig conf=new web_Config().voGet_Config_Info();
this.relativePath=conf.getUpload_file_path().trim();
this.maxSize = conf.getUpload_file_size()*1024;
this.primaryFileName=String.valueOf(new java.util.Date().getTime());
this.path =str+DoFile.doString(this.relativePath)+this.primaryFileName;
this.format = conf.getUpload_file_type().trim()+",";
return this.upload();
}
}Top
10 楼samkuang(执着前行)回复于 2005-02-01 18:44:44 得分 0
upTop




