当前位置:首页 > 技术问答集
firefox

如何用编码自动生成文件夹?

 所属目录:Java   |   类型:技术问答   |   时间:2007-05-21
 问题:

在*.cs中,我先自己定义这么一个函数  
  private   void   fileadd(string   path,byte[]   content)  
  {  
      filestream   filestream=new   filestream(path,system.io.filemode.create);  
      filestream.write(content,0,content.length);  
      filestream.close();  
  }  
   
  其中的filestream   filestream=new   filestream(path,system.io.filemode.create);我是想自动生成一个文件夹  
   
  接着我在触发按钮中写入如下的代码:  
  fileadd(server.mappath("./productfile/"+myfile),file);  
  其目的是为了自动生成一个名为productfile的文件夹  
  但是在测试时去报错——异常详细信息:   system.io.directorynotfoundexception:   未找到路径“c:\inetpub\wwwroot\coolmic\productfile\document.txt”的一部分。  
  请问问题是出在哪里??  
  应该如何解决??  
  在线等待,望各位大虾帮忙~  
  谢谢!

· 网友精彩回答:

发表者:linuxyf

生成文件夹用这个.  
  directory.createdirectory()

.
© 2006-2008 All Rights Reserved