文件上传路径问题《着急》

来源:百度知道 编辑:UC知道 时间:2024/09/22 06:45:42
JSP
<html:html>
<html:form action="/photoAction" method="POST" enctype="multipart/form-data">
<p>上传图片</p>
<p>图片:<html:file property="file"/></p>

<html:submit property="Submit" value="上传"/>
<html:reset value="重置"/>
</html:form>
</html:html>

try{
PhotoForm pf = (PhotoForm)form;
FormFile ff = pf.getFile();
String fname = ff.getFileName();
System.out.println("fileName======>"+fname);
if(ff.getFileName()!=null && ff.getFileSize()!=0)
{

File newFile = new File("F:/aa/");
newFile.mkdir();
System.out.println(newFile+"======>"+fname);
try
{
int size = ff.getFileSize();
System.out.println("size=======&

我在你另一个帖子里说了这一点, 需要设置(我在tomcat下)虚拟目录才能随心所愿

程序貌似没有错误。难道在页面打开文件夹的时候不显示图片文件?那你有没有看看打开文件窗口下边的打开类型?是不是没选择打开类型?
要不就试试别的标签,别用html标签