类型:转载 责任编辑:asp 日期:2007/03/01
html语句是这样的<html>
<head>
</head>
<body>
<form action="upload.jsp" method="post" name="thzp" enctype="multipart/form-data">
<input name="" type="file" size="50">
<input type="submit" value="upload">
......asdfadsfadsf
</form>
</body>
</html>
upload.jsp的语句是这样的:
// variables
int count=0;
// initialization
mysmartupload.initialize(pagecontext);
// only allow txt or htm files
mysmartupload.setallowedfileslist("htm,html,txt,,");
// deniedfileslist can also be used :
// mysmartupload.setdeniedfileslist("exe,bat,jsp");
// deny physical path
// mysmartupload.setdenyphysicalpath(true);
// only allow files smaller than 50000 bytes
// mysmartupload.setmaxfilesize(50000);
// deny upload if the total fila size is greater than 200000 bytes
// mysmartupload.settotalmaxfilesize(200000);
// upload
mysmartupload.upload();
// save the files with their original names in a virtual path of the web server
try {
count = mysmartupload.save("/upload", mysmartupload.save_virtual);
} catch (exception e){
out.println("<b>wrong selection : </b>" + e.tostring());
}
// display the number of files uploaded
out.println(count + " file(s) uploaded.");
现在我用的是resin。把upload建立在web-inf/classes/upload,另外也在doc/我的目录/upload下建了一个,最后提交后,却提示:“0 file(s) uploaded. ”啊,怎么办啊?
推荐阅读